diff --git a/.github/workflows/main-checks.yml b/.github/workflows/main-checks.yml index eca5852062d..6e0aa009a1c 100644 --- a/.github/workflows/main-checks.yml +++ b/.github/workflows/main-checks.yml @@ -48,7 +48,7 @@ jobs: - uses: browser-actions/setup-geckodriver@latest with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: nanasess/setup-chromedriver@v1 + - uses: nanasess/setup-chromedriver@v2 - name: Run doctest run: | @@ -67,7 +67,7 @@ jobs: fail-fast: false matrix: toolchain: - - 1.60.0 + - 1.64.0 - stable steps: @@ -95,7 +95,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: nanasess/setup-chromedriver@v1 + - uses: nanasess/setup-chromedriver@v2 - name: Run tests - yew run: | @@ -116,7 +116,7 @@ jobs: fail-fast: false matrix: toolchain: - - 1.60.0 + - 1.64.0 - stable - nightly diff --git a/.github/workflows/test-website.yml b/.github/workflows/test-website.yml index 456add40d5c..8f1c753b359 100644 --- a/.github/workflows/test-website.yml +++ b/.github/workflows/test-website.yml @@ -44,7 +44,7 @@ jobs: with: token: ${{ secrets.GITHUB_TOKEN }} - - uses: nanasess/setup-chromedriver@v1 + - uses: nanasess/setup-chromedriver@v2 - name: Run website code snippet tests run: cargo test -p website-test --target wasm32-unknown-unknown diff --git a/Cargo.lock b/Cargo.lock index 9d72b73f9e2..7ea36b2bc5b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -685,6 +685,12 @@ dependencies = [ "termcolor", ] +[[package]] +name = "equivalent" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" + [[package]] name = "errno" version = "0.3.1" @@ -1187,7 +1193,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -1200,6 +1206,12 @@ version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "headers" version = "0.3.8" @@ -1389,11 +1401,11 @@ dependencies = [ [[package]] name = "implicit-clone" -version = "0.3.5" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40fc102e70475c320b185cd18c1e48bba2d7210b63970a4d581ef903e4368ef7" +checksum = "73c84c395327945e71c6604eff15061c67849b9081318b4334b719bb2c11415f" dependencies = [ - "indexmap", + "indexmap 2.0.0", ] [[package]] @@ -1403,7 +1415,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", ] [[package]] @@ -3395,7 +3417,7 @@ dependencies = [ "gloo", "html-escape", "implicit-clone", - "indexmap", + "indexmap 2.0.0", "js-sys", "prokio", "rustversion", diff --git a/examples/communication_grandchild_with_grandparent/src/grandparent.rs b/examples/communication_grandchild_with_grandparent/src/grandparent.rs index dc859ef555e..222e5fb91fa 100644 --- a/examples/communication_grandchild_with_grandparent/src/grandparent.rs +++ b/examples/communication_grandchild_with_grandparent/src/grandparent.rs @@ -26,7 +26,7 @@ impl Component for GrandParent { match msg { Msg::ButtonClick(childs_name) => { // Update the shared state - let mut shared_state = Rc::make_mut(&mut self.state); + let shared_state = Rc::make_mut(&mut self.state); shared_state.total_clicks += 1; shared_state.last_clicked = Some(childs_name); true diff --git a/examples/immutable/Cargo.toml b/examples/immutable/Cargo.toml index c0a549e3ab4..df3a2b41b0f 100644 --- a/examples/immutable/Cargo.toml +++ b/examples/immutable/Cargo.toml @@ -6,7 +6,7 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -implicit-clone = { version = "0.3", features = ["map"] } +implicit-clone = { version = "0.4", features = ["map"] } wasm-bindgen = "0.2" web-sys = "0.3" yew = { path = "../../packages/yew", features = ["csr"] } diff --git a/packages/yew-macro/Cargo.toml b/packages/yew-macro/Cargo.toml index 93995281f55..7de16286e07 100644 --- a/packages/yew-macro/Cargo.toml +++ b/packages/yew-macro/Cargo.toml @@ -10,7 +10,7 @@ license = "MIT OR Apache-2.0" keywords = ["web", "wasm", "frontend", "webasm", "webassembly"] categories = ["gui", "web-programming", "wasm"] description = "A framework for making client-side single-page apps" -rust-version = "1.60.0" +rust-version = "1.64.0" [lib] proc-macro = true diff --git a/packages/yew-macro/Makefile.toml b/packages/yew-macro/Makefile.toml index 999a235920b..b679fa4fa51 100644 --- a/packages/yew-macro/Makefile.toml +++ b/packages/yew-macro/Makefile.toml @@ -1,6 +1,6 @@ [tasks.test] clear = true -toolchain = "1.60.0" +toolchain = "1.64.0" command = "cargo" # test target can be optionally specified like `cargo make test html_macro`, args = ["test", "${@}"] diff --git a/packages/yew-macro/src/hook/mod.rs b/packages/yew-macro/src/hook/mod.rs index ba186d323b2..f22fd4f722e 100644 --- a/packages/yew-macro/src/hook/mod.rs +++ b/packages/yew-macro/src/hook/mod.rs @@ -133,8 +133,8 @@ pub fn hook_impl(hook: HookFn) -> syn::Result { let inner_type_impl = if hook_sig.needs_boxing { let with_output = !matches!(hook_sig.output_type, Type::ImplTrait(_),); - let inner_fn_rt = with_output.then(|| &inner_fn_rt); - let output_type = with_output.then(|| &output_type); + let inner_fn_rt = with_output.then_some(&inner_fn_rt); + let output_type = with_output.then_some(&output_type); let hook_lifetime = &hook_sig.hook_lifetime; let hook_lifetime_plus = quote! { #hook_lifetime + }; diff --git a/packages/yew-macro/tests/classes_macro/classes-fail.stderr b/packages/yew-macro/tests/classes_macro/classes-fail.stderr index becd5587283..57cf0f21fb7 100644 --- a/packages/yew-macro/tests/classes_macro/classes-fail.stderr +++ b/packages/yew-macro/tests/classes_macro/classes-fail.stderr @@ -11,64 +11,76 @@ error: string literals must not contain more than one class (hint: use `"two", " | ^^^^^^^^^^^ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied - --> tests/classes_macro/classes-fail.rs:4:14 - | -4 | classes!(42); - | ^^ the trait `From<{integer}>` is not implemented for `Classes` - | - = help: the following implementations were found: - > - >> - > - > - and 6 others - = note: required because of the requirements on the impl of `Into` for `{integer}` + --> tests/classes_macro/classes-fail.rs:4:14 + | +4 | classes!(42); + | ^^ the trait `From<{integer}>` is not implemented for `Classes` + | + = help: the following other types implement trait `From`: + > + >> + > + > + > + >> + >> + > + and $N others + = note: required because of the requirements on the impl of `Into` for `{integer}` note: required by a bound in `Classes::push` - --> $WORKSPACE/packages/yew/src/html/classes.rs - | - | pub fn push>(&mut self, class: T) { - | ^^^^^^^^^^ required by this bound in `Classes::push` + --> $WORKSPACE/packages/yew/src/html/classes.rs + | + | pub fn push>(&mut self, class: T) { + | ^^^^^^^^^^ required by this bound in `Classes::push` error[E0277]: the trait bound `Classes: From<{float}>` is not satisfied - --> tests/classes_macro/classes-fail.rs:5:14 - | -5 | classes!(42.0); - | ^^^^ the trait `From<{float}>` is not implemented for `Classes` - | - = help: the following implementations were found: - > - >> - > - > - and 6 others - = note: required because of the requirements on the impl of `Into` for `{float}` + --> tests/classes_macro/classes-fail.rs:5:14 + | +5 | classes!(42.0); + | ^^^^ the trait `From<{float}>` is not implemented for `Classes` + | + = help: the following other types implement trait `From`: + > + >> + > + > + > + >> + >> + > + and $N others + = note: required because of the requirements on the impl of `Into` for `{float}` note: required by a bound in `Classes::push` - --> $WORKSPACE/packages/yew/src/html/classes.rs - | - | pub fn push>(&mut self, class: T) { - | ^^^^^^^^^^ required by this bound in `Classes::push` + --> $WORKSPACE/packages/yew/src/html/classes.rs + | + | pub fn push>(&mut self, class: T) { + | ^^^^^^^^^^ required by this bound in `Classes::push` error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied - --> tests/classes_macro/classes-fail.rs:9:14 - | -9 | classes!(vec![42]); - | ^^^ the trait `From<{integer}>` is not implemented for `Classes` - | - = help: the following implementations were found: - > - >> - > - > - and 6 others - = note: required because of the requirements on the impl of `Into` for `{integer}` - = note: required because of the requirements on the impl of `From>` for `Classes` - = note: 1 redundant requirement hidden - = note: required because of the requirements on the impl of `Into` for `Vec<{integer}>` + --> tests/classes_macro/classes-fail.rs:9:14 + | +9 | classes!(vec![42]); + | ^^^ the trait `From<{integer}>` is not implemented for `Classes` + | + = help: the following other types implement trait `From`: + > + >> + > + > + > + >> + >> + > + and $N others + = note: required because of the requirements on the impl of `Into` for `{integer}` + = note: required because of the requirements on the impl of `From>` for `Classes` + = note: 1 redundant requirement hidden + = note: required because of the requirements on the impl of `Into` for `Vec<{integer}>` note: required by a bound in `Classes::push` - --> $WORKSPACE/packages/yew/src/html/classes.rs - | - | pub fn push>(&mut self, class: T) { - | ^^^^^^^^^^ required by this bound in `Classes::push` + --> $WORKSPACE/packages/yew/src/html/classes.rs + | + | pub fn push>(&mut self, class: T) { + | ^^^^^^^^^^ required by this bound in `Classes::push` error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied --> tests/classes_macro/classes-fail.rs:13:14 @@ -76,12 +88,16 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied 13 | classes!(some); | ^^^^ the trait `From<{integer}>` is not implemented for `Classes` | - = help: the following implementations were found: + = help: the following other types implement trait `From`: > >> > > - and 6 others + > + >> + >> + > + and $N others = note: required because of the requirements on the impl of `Into` for `{integer}` = note: required because of the requirements on the impl of `From>` for `Classes` = note: 1 redundant requirement hidden @@ -98,12 +114,16 @@ error[E0277]: the trait bound `Classes: From` is not satisfied 14 | classes!(none); | ^^^^ the trait `From` is not implemented for `Classes` | - = help: the following implementations were found: + = help: the following other types implement trait `From`: > >> > > - and 6 others + > + >> + >> + > + and $N others = note: required because of the requirements on the impl of `Into` for `u32` = note: required because of the requirements on the impl of `From>` for `Classes` = note: 1 redundant requirement hidden @@ -120,12 +140,16 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied 16 | classes!("one", 42); | ^^ the trait `From<{integer}>` is not implemented for `Classes` | - = help: the following implementations were found: + = help: the following other types implement trait `From`: > >> > > - and 6 others + > + >> + >> + > + and $N others = note: required because of the requirements on the impl of `Into` for `{integer}` note: required by a bound in `Classes::push` --> $WORKSPACE/packages/yew/src/html/classes.rs diff --git a/packages/yew-macro/tests/classes_macro_test.rs b/packages/yew-macro/tests/classes_macro_test.rs index 84b1b5fda48..e2cadf8cf39 100644 --- a/packages/yew-macro/tests/classes_macro_test.rs +++ b/packages/yew-macro/tests/classes_macro_test.rs @@ -1,5 +1,5 @@ #[allow(dead_code)] -#[rustversion::attr(stable(1.60), test)] +#[rustversion::attr(stable(1.64), test)] fn classes_macro() { let t = trybuild::TestCases::new(); t.pass("tests/classes_macro/*-pass.rs"); diff --git a/packages/yew-macro/tests/derive_props/fail.stderr b/packages/yew-macro/tests/derive_props/fail.stderr index 35c88342d29..441b184c78d 100644 --- a/packages/yew-macro/tests/derive_props/fail.stderr +++ b/packages/yew-macro/tests/derive_props/fail.stderr @@ -25,33 +25,18 @@ note: these functions exist but are inaccessible 102 | fn foo() -> i32 { | ^^^^^^^^^^^^^^^ `crate::t10::foo`: not accessible -error[E0277]: the trait bound `AssertAllProps: HasProp` is not satisfied - --> tests/derive_props/fail.rs:35:24 - | -35 | ::yew::props!{ Props { } }; - | ^^^^^ the trait `HasProp` is not implemented for `AssertAllProps` - | -note: required because of the requirements on the impl of `HasAllProps` for `t3::CheckPropsAll` - --> tests/derive_props/fail.rs:29:21 - | -29 | #[derive(Clone, Properties, PartialEq)] - | ^^^^^^^^^^ - = note: required because of the requirements on the impl of `AllPropsFor` for `AssertAllProps` -note: required by a bound in `html::component::properties::__macro::PreBuild::::build` - --> $WORKSPACE/packages/yew/src/html/component/properties.rs - | - | Token: AllPropsFor, - | ^^^^^^^^^^^^^^^^^^^ required by this bound in `html::component::properties::__macro::PreBuild::::build` - = note: this error originates in the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) - error[E0277]: the trait bound `Value: Default` is not satisfied - --> tests/derive_props/fail.rs:9:21 - | -9 | #[derive(Clone, Properties, PartialEq)] - | ^^^^^^^^^^ the trait `Default` is not implemented for `Value` - | + --> tests/derive_props/fail.rs:9:21 + | +9 | #[derive(Clone, Properties, PartialEq)] + | ^^^^^^^^^^ the trait `Default` is not implemented for `Value` + | note: required by a bound in `Option::::unwrap_or_default` - = note: this error originates in the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) +help: consider annotating `Value` with `#[derive(Default)]` + | +8 | #[derive(Default)] + | error[E0369]: binary operation `==` cannot be applied to type `Value` --> tests/derive_props/fail.rs:13:9 @@ -66,7 +51,7 @@ note: an implementation of `PartialEq<_>` might be missing for `Value` --> tests/derive_props/fail.rs:8:5 | 8 | struct Value; - | ^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Value` with `#[derive(PartialEq)]` | @@ -86,19 +71,52 @@ note: an implementation of `PartialEq<_>` might be missing for `Value` --> tests/derive_props/fail.rs:8:5 | 8 | struct Value; - | ^^^^^^^^^^^^^ must implement `PartialEq<_>` + | ^^^^^^^^^^^^ must implement `PartialEq<_>` = note: this error originates in the derive macro `PartialEq` (in Nightly builds, run with -Z macro-backtrace for more info) help: consider annotating `Value` with `#[derive(PartialEq)]` | 8 | #[derive(PartialEq)] | +error[E0277]: the trait bound `AssertAllProps: HasProp` is not satisfied + --> tests/derive_props/fail.rs:35:24 + | +35 | ::yew::props!{ Props { } }; + | ^^^^^ the trait `HasProp` is not implemented for `AssertAllProps` + | + = help: the following other types implement trait `HasProp`: + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + and $N others +note: required because of the requirements on the impl of `HasAllProps` for `t3::CheckPropsAll` + --> tests/derive_props/fail.rs:29:21 + | +29 | #[derive(Clone, Properties, PartialEq)] + | ^^^^^^^^^^ + = note: required because of the requirements on the impl of `AllPropsFor` for `AssertAllProps` +note: required by a bound in `html::component::properties::__macro::PreBuild::::build` + --> $WORKSPACE/packages/yew/src/html/component/properties.rs + | + | Token: AllPropsFor, + | ^^^^^^^^^^^^^^^^^^^ required by this bound in `html::component::properties::__macro::PreBuild::::build` + = note: this error originates in the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) + error[E0308]: mismatched types --> tests/derive_props/fail.rs:54:19 | 54 | #[prop_or(123)] - | ^^^ expected struct `String`, found integer + | ^^^ + | | + | expected struct `String`, found integer + | arguments to this function are incorrect | +note: associated function defined here help: try using a conversion method | 54 | #[prop_or(123.to_string())] @@ -107,30 +125,30 @@ help: try using a conversion method | ++++++++++++ error[E0277]: expected a `FnOnce<()>` closure, found `{integer}` - --> tests/derive_props/fail.rs:64:24 - | -64 | #[prop_or_else(123)] - | ^^^ expected an `FnOnce<()>` closure, found `{integer}` - | - = help: the trait `FnOnce<()>` is not implemented for `{integer}` - = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` + --> tests/derive_props/fail.rs:64:24 + | +64 | #[prop_or_else(123)] + | ^^^ expected an `FnOnce<()>` closure, found `{integer}` + | + = help: the trait `FnOnce<()>` is not implemented for `{integer}` + = note: wrap the `{integer}` in a closure with no arguments: `|| { /* code */ }` note: required by a bound in `Option::::unwrap_or_else` error[E0593]: function is expected to take 0 arguments, but it takes 1 argument - --> tests/derive_props/fail.rs:84:24 - | -84 | #[prop_or_else(foo)] - | ^^^ expected function that takes 0 arguments + --> tests/derive_props/fail.rs:84:24 + | +84 | #[prop_or_else(foo)] + | ^^^ expected function that takes 0 arguments ... -88 | fn foo(bar: i32) -> String { - | -------------------------- takes 1 argument - | +88 | fn foo(bar: i32) -> String { + | -------------------------- takes 1 argument + | note: required by a bound in `Option::::unwrap_or_else` error[E0271]: type mismatch resolving ` i32 {t10::foo} as FnOnce<()>>::Output == String` - --> tests/derive_props/fail.rs:98:24 - | -98 | #[prop_or_else(foo)] - | ^^^ expected struct `String`, found `i32` - | + --> tests/derive_props/fail.rs:98:24 + | +98 | #[prop_or_else(foo)] + | ^^^ expected struct `String`, found `i32` + | note: required by a bound in `Option::::unwrap_or_else` diff --git a/packages/yew-macro/tests/derive_props_test.rs b/packages/yew-macro/tests/derive_props_test.rs index c4d8892e03c..c98e8feb953 100644 --- a/packages/yew-macro/tests/derive_props_test.rs +++ b/packages/yew-macro/tests/derive_props_test.rs @@ -1,5 +1,5 @@ #[allow(dead_code)] -#[rustversion::attr(stable(1.60), test)] +#[rustversion::attr(stable(1.64), test)] fn derive_props() { let t = trybuild::TestCases::new(); t.pass("tests/derive_props/pass.rs"); diff --git a/packages/yew-macro/tests/function_attr_test.rs b/packages/yew-macro/tests/function_attr_test.rs index d9409490389..ed3cf9d044a 100644 --- a/packages/yew-macro/tests/function_attr_test.rs +++ b/packages/yew-macro/tests/function_attr_test.rs @@ -1,5 +1,5 @@ #[allow(dead_code)] -#[rustversion::attr(stable(1.60), test)] +#[rustversion::attr(stable(1.64), test)] fn tests() { let t = trybuild::TestCases::new(); t.pass("tests/function_component_attr/*-pass.rs"); diff --git a/packages/yew-macro/tests/function_component_attr/bad-return-type-fail.stderr b/packages/yew-macro/tests/function_component_attr/bad-return-type-fail.stderr index 6e99e7d6473..9b8e8a2ab5d 100644 --- a/packages/yew-macro/tests/function_component_attr/bad-return-type-fail.stderr +++ b/packages/yew-macro/tests/function_component_attr/bad-return-type-fail.stderr @@ -10,4 +10,7 @@ error[E0277]: the trait bound `u32: IntoHtmlResult` is not satisfied 11 | #[function_component(Comp)] | ^^^^^^^^^^^^^^^^^^^^^^^^^^^ the trait `IntoHtmlResult` is not implemented for `u32` | + = help: the following other types implement trait `IntoHtmlResult`: + Result + VNode = note: this error originates in the attribute macro `function_component` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/packages/yew-macro/tests/function_component_attr/generic-props-fail.stderr b/packages/yew-macro/tests/function_component_attr/generic-props-fail.stderr index e298c0cc8ac..e60f09af641 100644 --- a/packages/yew-macro/tests/function_component_attr/generic-props-fail.stderr +++ b/packages/yew-macro/tests/function_component_attr/generic-props-fail.stderr @@ -13,6 +13,16 @@ error[E0277]: the trait bound `AssertAllProps: HasProp` is not satisfied 22 | html! { /> }; | ^^^^ the trait `HasProp` is not implemented for `AssertAllProps` | + = help: the following other types implement trait `HasProp`: + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + and $N others note: required because of the requirements on the impl of `HasAllProps` for `CheckPropsAll` --> tests/function_component_attr/generic-props-fail.rs:3:17 | @@ -24,7 +34,7 @@ note: required by a bound in `yew::html::component::properties::__macro::PreBuil | | Token: AllPropsFor, | ^^^^^^^^^^^^^^^^^^^ required by this bound in `yew::html::component::properties::__macro::PreBuild::::build` - = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `html` which comes from the expansion of the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `Comp: yew::BaseComponent` is not satisfied --> tests/function_component_attr/generic-props-fail.rs:27:14 @@ -32,33 +42,26 @@ error[E0277]: the trait bound `Comp: yew::BaseComponent` is n 27 | html! { /> }; | ^^^^ the trait `yew::BaseComponent` is not implemented for `Comp` | - = help: the following implementations were found: - as yew::BaseComponent> + = help: the trait `yew::BaseComponent` is implemented for `Comp

` = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0599]: the function or associated item `new` exists for struct `VChild>`, but its trait bounds were not satisfied - --> tests/function_component_attr/generic-props-fail.rs:27:14 - | -8 | #[function_component(Comp)] - | --------------------------- doesn't satisfy `Comp: yew::BaseComponent` + --> tests/function_component_attr/generic-props-fail.rs:27:14 + | +8 | #[function_component(Comp)] + | ------------------------- doesn't satisfy `Comp: yew::BaseComponent` ... -27 | html! { /> }; - | ^^^^ function or associated item cannot be called on `VChild>` due to unsatisfied trait bounds - | - = note: the following trait bounds were not satisfied: - `Comp: yew::BaseComponent` +27 | html! { /> }; + | ^^^^ function or associated item cannot be called on `VChild>` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `Comp: yew::BaseComponent` note: the following trait must be implemented - --> $WORKSPACE/packages/yew/src/html/component/mod.rs - | - | / pub trait BaseComponent: Sized + 'static { - | | /// The Component's Message. - | | type Message: 'static; - | | -... | - | | fn prepare_state(&self) -> Option; - | | } - | |_^ - = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/packages/yew/src/html/component/mod.rs + | + | pub trait BaseComponent: Sized + 'static { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `MissingTypeBounds: yew::Properties` is not satisfied --> tests/function_component_attr/generic-props-fail.rs:27:14 @@ -66,6 +69,12 @@ error[E0277]: the trait bound `MissingTypeBounds: yew::Properties` is not satisf 27 | html! { /> }; | ^^^^ the trait `yew::Properties` is not implemented for `MissingTypeBounds` | + = help: the following other types implement trait `yew::Properties`: + () + ChildrenProps + ContextProviderProps + Props + SuspenseProps note: required by a bound in `Comp` --> tests/function_component_attr/generic-props-fail.rs:11:8 | diff --git a/packages/yew-macro/tests/hook_attr_test.rs b/packages/yew-macro/tests/hook_attr_test.rs index dae90940ee7..bd0a3b28812 100644 --- a/packages/yew-macro/tests/hook_attr_test.rs +++ b/packages/yew-macro/tests/hook_attr_test.rs @@ -1,5 +1,5 @@ #[allow(dead_code)] -#[rustversion::attr(stable(1.60), test)] +#[rustversion::attr(stable(1.64), test)] fn tests() { let t = trybuild::TestCases::new(); t.pass("tests/hook_attr/*-pass.rs"); diff --git a/packages/yew-macro/tests/hook_macro_test.rs b/packages/yew-macro/tests/hook_macro_test.rs index cb79efc253b..01e81a41345 100644 --- a/packages/yew-macro/tests/hook_macro_test.rs +++ b/packages/yew-macro/tests/hook_macro_test.rs @@ -1,5 +1,5 @@ #[allow(dead_code)] -#[rustversion::attr(stable(1.60), test)] +#[rustversion::attr(stable(1.64), test)] fn tests() { let t = trybuild::TestCases::new(); t.pass("tests/hook_macro/*-pass.rs"); diff --git a/packages/yew-macro/tests/html_macro/component-fail.stderr b/packages/yew-macro/tests/html_macro/component-fail.stderr index 40917e85ac7..371362c18bc 100644 --- a/packages/yew-macro/tests/html_macro/component-fail.stderr +++ b/packages/yew-macro/tests/html_macro/component-fail.stderr @@ -433,7 +433,7 @@ error[E0599]: no method named `r#type` found for struct `ChildPropertiesBuilder` --> tests/html_macro/component-fail.rs:85:20 | 4 | #[derive(Clone, Properties, PartialEq)] - | ---------- method `r#type` not found for this + | ---------- method `r#type` not found for this struct ... 85 | html! { }; | ^^^^ method not found in `ChildPropertiesBuilder` @@ -450,7 +450,7 @@ error[E0599]: no method named `unknown` found for struct `ChildPropertiesBuilder --> tests/html_macro/component-fail.rs:88:20 | 4 | #[derive(Clone, Properties, PartialEq)] - | ---------- method `unknown` not found for this + | ---------- method `unknown` not found for this struct ... 88 | html! { }; | ^^^^^^^ method not found in `ChildPropertiesBuilder` @@ -463,6 +463,16 @@ error[E0277]: the trait bound `(): IntoPropValue` is not satisfied | | | required by a bound introduced by this call | + = help: the following other types implement trait `IntoPropValue`: + <&'static [(K, V)] as IntoPropValue>> + <&'static [T] as IntoPropValue>> + <&'static str as IntoPropValue> + <&'static str as IntoPropValue>> + <&'static str as IntoPropValue>> + <&'static str as IntoPropValue> + <&'static str as IntoPropValue> + <&T as IntoPropValue>> + and $N others note: required by a bound in `ChildPropertiesBuilder::string` --> tests/html_macro/component-fail.rs:4:17 | @@ -481,11 +491,15 @@ error[E0277]: the trait bound `{integer}: IntoPropValue` is not satisfie | | | required by a bound introduced by this call | - = help: the following implementations were found: - >> - >> - >> - >> + = help: the following other types implement trait `IntoPropValue`: + f32 + f64 + i128 + i16 + i32 + i64 + i8 + isize and $N others note: required by a bound in `ChildPropertiesBuilder::string` --> tests/html_macro/component-fail.rs:4:17 @@ -505,11 +519,15 @@ error[E0277]: the trait bound `{integer}: IntoPropValue` is not satisfie | | | required by a bound introduced by this call | - = help: the following implementations were found: - >> - >> - >> - >> + = help: the following other types implement trait `IntoPropValue`: + f32 + f64 + i128 + i16 + i32 + i64 + i8 + isize and $N others note: required by a bound in `ChildPropertiesBuilder::string` --> tests/html_macro/component-fail.rs:4:17 @@ -533,7 +551,7 @@ error[E0599]: no method named `r#ref` found for struct `ChildPropertiesBuilder` --> tests/html_macro/component-fail.rs:96:26 | 4 | #[derive(Clone, Properties, PartialEq)] - | ---------- method `r#ref` not found for this + | ---------- method `r#ref` not found for this struct ... 96 | html! { }; | ^^^^^ method not found in `ChildPropertiesBuilder` @@ -546,11 +564,15 @@ error[E0277]: the trait bound `u32: IntoPropValue` is not satisfied | | | required by a bound introduced by this call | - = help: the following implementations were found: - >> - >> - >> - >> + = help: the following other types implement trait `IntoPropValue`: + f32 + f64 + i128 + i16 + i32 + i64 + i8 + isize and $N others note: required by a bound in `ChildPropertiesBuilder::int` --> tests/html_macro/component-fail.rs:4:17 @@ -568,6 +590,16 @@ error[E0277]: the trait bound `AssertAllProps: HasProp` is not satisfied 99 | html! { }; | ^^^^^ the trait `HasProp` is not implemented for `AssertAllProps` | + = help: the following other types implement trait `HasProp`: + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp<_ChildContainerProperties::children, HasChildContainerPropertieschildren>> + as HasProp>> + and $N others note: required because of the requirements on the impl of `HasAllProps` for `CheckChildPropertiesAll` --> tests/html_macro/component-fail.rs:4:17 | @@ -579,7 +611,7 @@ note: required by a bound in `yew::html::component::properties::__macro::PreBuil | | Token: AllPropsFor, | ^^^^^^^^^^^^^^^^^^^ required by this bound in `yew::html::component::properties::__macro::PreBuild::::build` - = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `html` which comes from the expansion of the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0609]: no field `children` on type `ChildProperties` --> tests/html_macro/component-fail.rs:103:14 @@ -594,7 +626,7 @@ error[E0599]: no method named `children` found for struct `ChildPropertiesBuilde --> tests/html_macro/component-fail.rs:103:14 | 4 | #[derive(Clone, Properties, PartialEq)] - | ---------- method `children` not found for this + | ---------- method `children` not found for this struct ... 103 | html! { { "Not allowed" } }; | ^^^^^ method not found in `ChildPropertiesBuilder` @@ -616,6 +648,16 @@ error[E0277]: the trait bound `AssertAllProps: HasProp<_ChildContainerProperties 115 | html! { }; | ^^^^^^^^^^^^^^ the trait `HasProp<_ChildContainerProperties::children, _>` is not implemented for `AssertAllProps` | + = help: the following other types implement trait `HasProp`: + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp<_ChildContainerProperties::children, HasChildContainerPropertieschildren>> + as HasProp>> + and $N others note: required because of the requirements on the impl of `HasAllProps` for `CheckChildContainerPropertiesAll` --> tests/html_macro/component-fail.rs:24:17 | @@ -627,7 +669,7 @@ note: required by a bound in `yew::html::component::properties::__macro::PreBuil | | Token: AllPropsFor, | ^^^^^^^^^^^^^^^^^^^ required by this bound in `yew::html::component::properties::__macro::PreBuild::::build` - = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `html` which comes from the expansion of the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `AssertAllProps: HasProp<_ChildContainerProperties::children, _>` is not satisfied --> tests/html_macro/component-fail.rs:116:14 @@ -635,6 +677,16 @@ error[E0277]: the trait bound `AssertAllProps: HasProp<_ChildContainerProperties 116 | html! { }; | ^^^^^^^^^^^^^^ the trait `HasProp<_ChildContainerProperties::children, _>` is not implemented for `AssertAllProps` | + = help: the following other types implement trait `HasProp`: + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp>> + as HasProp<_ChildContainerProperties::children, HasChildContainerPropertieschildren>> + as HasProp>> + and $N others note: required because of the requirements on the impl of `HasAllProps` for `CheckChildContainerPropertiesAll` --> tests/html_macro/component-fail.rs:24:17 | @@ -646,18 +698,15 @@ note: required by a bound in `yew::html::component::properties::__macro::PreBuil | | Token: AllPropsFor, | ^^^^^^^^^^^^^^^^^^^ required by this bound in `yew::html::component::properties::__macro::PreBuild::::build` - = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `html` which comes from the expansion of the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `yew::virtual_dom::VText: IntoPropValue>>` is not satisfied - --> tests/html_macro/component-fail.rs:117:31 + --> tests/html_macro/component-fail.rs:117:14 | 117 | html! { { "Not allowed" } }; - | -------------- ^^^^^^^^^^^^^ the trait `IntoPropValue>>` is not implemented for `yew::virtual_dom::VText` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^ the trait `IntoPropValue>>` is not implemented for `yew::virtual_dom::VText` | - = help: the following implementations were found: - >> + = help: the trait `IntoPropValue>` is implemented for `yew::virtual_dom::VText` note: required by a bound in `ChildContainerPropertiesBuilder::children` --> tests/html_macro/component-fail.rs:24:17 | @@ -666,7 +715,7 @@ note: required by a bound in `ChildContainerPropertiesBuilder::children` 25 | pub struct ChildContainerProperties { 26 | pub children: ChildrenWithProps, | -------- required by a bound in this - = note: this error originates in the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `html` which comes from the expansion of the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0277]: the trait bound `VChild: From` is not satisfied --> tests/html_macro/component-fail.rs:118:29 @@ -677,15 +726,12 @@ error[E0277]: the trait bound `VChild: From` is not satisfied = note: required because of the requirements on the impl of `Into>` for `VNode` error[E0277]: the trait bound `VNode: IntoPropValue>>` is not satisfied - --> tests/html_macro/component-fail.rs:119:30 + --> tests/html_macro/component-fail.rs:119:14 | 119 | html! { }; - | -------------- ^^^^^ the trait `IntoPropValue>>` is not implemented for `VNode` - | | - | required by a bound introduced by this call + | ^^^^^^^^^^^^^^ the trait `IntoPropValue>>` is not implemented for `VNode` | - = help: the following implementations were found: - >> + = help: the trait `IntoPropValue>` is implemented for `VNode` note: required by a bound in `ChildContainerPropertiesBuilder::children` --> tests/html_macro/component-fail.rs:24:17 | @@ -694,4 +740,4 @@ note: required by a bound in `ChildContainerPropertiesBuilder::children` 25 | pub struct ChildContainerProperties { 26 | pub children: ChildrenWithProps, | -------- required by a bound in this - = note: this error originates in the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) + = note: this error originates in the macro `html` which comes from the expansion of the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/packages/yew-macro/tests/html_macro/component-unimplemented-fail.stderr b/packages/yew-macro/tests/html_macro/component-unimplemented-fail.stderr index 480c0693b39..b229ced60b6 100644 --- a/packages/yew-macro/tests/html_macro/component-unimplemented-fail.stderr +++ b/packages/yew-macro/tests/html_macro/component-unimplemented-fail.stderr @@ -4,29 +4,24 @@ error[E0277]: the trait bound `Unimplemented: yew::Component` is not satisfied 6 | html! { }; | ^^^^^^^^^^^^^ the trait `yew::Component` is not implemented for `Unimplemented` | + = help: the trait `yew::Component` is implemented for `ContextProvider` = note: required because of the requirements on the impl of `BaseComponent` for `Unimplemented` = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info) error[E0599]: the function or associated item `new` exists for struct `VChild`, but its trait bounds were not satisfied - --> tests/html_macro/component-unimplemented-fail.rs:6:14 - | -3 | struct Unimplemented; - | --------------------- doesn't satisfy `Unimplemented: BaseComponent` + --> tests/html_macro/component-unimplemented-fail.rs:6:14 + | +3 | struct Unimplemented; + | -------------------- doesn't satisfy `Unimplemented: BaseComponent` ... -6 | html! { }; - | ^^^^^^^^^^^^^ function or associated item cannot be called on `VChild` due to unsatisfied trait bounds - | - = note: the following trait bounds were not satisfied: - `Unimplemented: BaseComponent` +6 | html! { }; + | ^^^^^^^^^^^^^ function or associated item cannot be called on `VChild` due to unsatisfied trait bounds + | + = note: the following trait bounds were not satisfied: + `Unimplemented: BaseComponent` note: the following trait must be implemented - --> $WORKSPACE/packages/yew/src/html/component/mod.rs - | - | / pub trait BaseComponent: Sized + 'static { - | | /// The Component's Message. - | | type Message: 'static; - | | -... | - | | fn prepare_state(&self) -> Option; - | | } - | |_^ - = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info) + --> $WORKSPACE/packages/yew/src/html/component/mod.rs + | + | pub trait BaseComponent: Sized + 'static { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info) diff --git a/packages/yew-macro/tests/html_macro/element-fail.stderr b/packages/yew-macro/tests/html_macro/element-fail.stderr index ecb38f61c01..1946d88f0f1 100644 --- a/packages/yew-macro/tests/html_macro/element-fail.stderr +++ b/packages/yew-macro/tests/html_macro/element-fail.stderr @@ -369,22 +369,40 @@ error[E0308]: mismatched types --> tests/html_macro/element-fail.rs:36:28 | 36 | html! { }; - | ^ expected `bool`, found integer + | -----------------------^----- + | | | + | | expected `bool`, found integer + | arguments to this enum variant are incorrect + | +note: tuple variant defined here error[E0308]: mismatched types --> tests/html_macro/element-fail.rs:37:29 | 37 | html! { }; - | ^^^^^^^^^^^ expected `bool`, found enum `Option` + | ------------------------^^^^^^^^^^^------ + | | | + | | expected `bool`, found enum `Option` + | arguments to this enum variant are incorrect | = note: expected type `bool` found enum `Option` +note: tuple variant defined here error[E0308]: mismatched types --> tests/html_macro/element-fail.rs:38:29 | 38 | html! { }; - | ^ expected `bool`, found integer + | ^ + | | + | expected `bool`, found integer + | arguments to this function are incorrect + | +note: function defined here + --> $WORKSPACE/packages/yew/src/utils/mod.rs + | + | pub fn __ensure_type(_: T) {} + | ^^^^^^^^^^^^^ error[E0308]: mismatched types --> tests/html_macro/element-fail.rs:39:30 @@ -399,63 +417,112 @@ error[E0308]: mismatched types --> tests/html_macro/element-fail.rs:40:30 | 40 | html! {