Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/main-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ jobs:
fail-fast: false
matrix:
toolchain:
- 1.76.0
- 1.78.0
- stable

steps:
Expand Down Expand Up @@ -120,7 +120,7 @@ jobs:
fail-fast: false
matrix:
toolchain:
- 1.76.0
- 1.78.0
- stable
- nightly

Expand Down
2 changes: 1 addition & 1 deletion examples/wasi_ssr_module/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub async fn render() -> Result<String> {
#[tokio::main(flavor = "current_thread")]
async fn main() -> Result<()> {
let ret = render().await?;
println!("{}", ret);
println!("{ret}");

Ok(())
}
2 changes: 1 addition & 1 deletion examples/web_worker_fib/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn Main() -> Html {
// start the worker
let output_value = fib_agent.run(input_value).await;

output.set(format!("Fibonacci value: {}", output_value));
output.set(format!("Fibonacci value: {output_value}"));
});
}
};
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-agent-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "yew-agent-macro"
version = "0.2.0"
edition = "2021"
rust-version = "1.76.0"
rust-version = "1.78.0"
authors = ["Kaede Hoshikawa <[email protected]>"]
repository = "https://github.com/yewstack/yew"
homepage = "https://yew.rs"
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-agent/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ edition = "2021"
readme = "../../README.md"
description = "Agents for Yew"
license = "MIT OR Apache-2.0"
rust-version = "1.76.0"
rust-version = "1.78.0"

[dependencies]
yew = { version = "0.21.0", path = "../yew" }
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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.76.0"
rust-version = "1.78.0"

[lib]
proc-macro = true
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/Makefile.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tasks.test]
clear = true
toolchain = "1.76.0"
toolchain = "1.78.0"
command = "cargo"
# test target can be optionally specified like `cargo make test html_macro`,
args = ["test", "${@}"]
Expand Down
3 changes: 3 additions & 0 deletions packages/yew-macro/src/derive_props/builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ impl PropsBuilder<'_> {
quote! {
#[automatically_derived]
#( #extra_attrs )*
#[diagnostic::do_not_recommend]
impl #builder_impl_generics #builder_name<#generic_args> #builder_where_clause {
#( #prop_fns )*
}
Expand All @@ -142,11 +143,13 @@ impl PropsBuilder<'_> {
#vis struct #check_all_props_name<How>(::std::marker::PhantomData<How>);

#[automatically_derived]
#[diagnostic::do_not_recommend]
impl<B, P, How> ::yew::html::HasProp<P, &dyn ::yew::html::HasProp<P, How>>
for #check_all_props_name<B>
where B: ::yew::html::HasProp<P, How> {}

#[automatically_derived]
#[diagnostic::do_not_recommend]
impl #check_impl_generics ::yew::html::HasAllProps<
#props_name #ty_generics ,
( #( #check_args , )* ),
Expand Down
3 changes: 3 additions & 0 deletions packages/yew-macro/src/derive_props/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,12 @@ impl PropFieldCheck<'_> {
#vis struct #check_struct<How>(::std::marker::PhantomData<How>);

#[automatically_derived]
#[diagnostic::do_not_recommend]
impl<B> ::yew::html::HasProp< #prop_name_mod :: #prop_check_name, #check_struct<B>>
for #check_struct<B> {}

#[automatically_derived]
#[diagnostic::do_not_recommend]
impl<B, P, How> ::yew::html::HasProp<P, &dyn ::yew::html::HasProp<P, How>>
for #check_struct<B>
where B: ::yew::html::HasProp<P, How> {}
Expand Down
24 changes: 12 additions & 12 deletions packages/yew-macro/tests/classes_macro/classes-fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ 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`
| ^^ the trait `From<{integer}>` is not implemented for `Classes`, which is required by `{integer}: Into<Classes>`
|
= help: the following other types implement trait `From<T>`:
<Classes as From<Cow<'static, str>>>
<Classes as From<implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Vec<T>>>
<Classes as From<String>>
<Classes as From<Option<T>>>
Expand All @@ -37,11 +37,11 @@ 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`
| ^^^^ the trait `From<{float}>` is not implemented for `Classes`, which is required by `{float}: Into<Classes>`
|
= help: the following other types implement trait `From<T>`:
<Classes as From<Cow<'static, str>>>
<Classes as From<implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Vec<T>>>
<Classes as From<String>>
<Classes as From<Option<T>>>
Expand All @@ -62,12 +62,12 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
9 | classes!(vec![42]);
| ---^^^^^
| |
| the trait `From<{integer}>` is not implemented for `Classes`
| the trait `From<{integer}>` is not implemented for `Classes`, which is required by `Vec<{integer}>: Into<Classes>`
| required by a bound introduced by this call
|
= help: the following other types implement trait `From<T>`:
<Classes as From<Cow<'static, str>>>
<Classes as From<implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Vec<T>>>
<Classes as From<String>>
<Classes as From<Option<T>>>
Expand All @@ -89,11 +89,11 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
--> tests/classes_macro/classes-fail.rs:13:14
|
13 | classes!(some);
| ^^^^ the trait `From<{integer}>` is not implemented for `Classes`
| ^^^^ the trait `From<{integer}>` is not implemented for `Classes`, which is required by `Option<{integer}>: Into<Classes>`
|
= help: the following other types implement trait `From<T>`:
<Classes as From<Cow<'static, str>>>
<Classes as From<implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Vec<T>>>
<Classes as From<String>>
<Classes as From<Option<T>>>
Expand All @@ -115,11 +115,11 @@ error[E0277]: the trait bound `Classes: From<u32>` is not satisfied
--> tests/classes_macro/classes-fail.rs:14:14
|
14 | classes!(none);
| ^^^^ the trait `From<u32>` is not implemented for `Classes`
| ^^^^ the trait `From<u32>` is not implemented for `Classes`, which is required by `Option<u32>: Into<Classes>`
|
= help: the following other types implement trait `From<T>`:
<Classes as From<Cow<'static, str>>>
<Classes as From<implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Vec<T>>>
<Classes as From<String>>
<Classes as From<Option<T>>>
Expand All @@ -141,11 +141,11 @@ error[E0277]: the trait bound `Classes: From<{integer}>` is not satisfied
--> tests/classes_macro/classes-fail.rs:16:21
|
16 | classes!("one", 42);
| ^^ the trait `From<{integer}>` is not implemented for `Classes`
| ^^ the trait `From<{integer}>` is not implemented for `Classes`, which is required by `{integer}: Into<Classes>`
|
= help: the following other types implement trait `From<T>`:
<Classes as From<Cow<'static, str>>>
<Classes as From<implicit_clone::unsync::string::IString>>
<Classes as From<Cow<'static, str>>>
<Classes as From<Vec<T>>>
<Classes as From<String>>
<Classes as From<Option<T>>>
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/tests/classes_macro_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[allow(dead_code)]
#[rustversion::attr(stable(1.76), test)]
#[rustversion::attr(stable(1.78), test)]
fn classes_macro() {
let t = trybuild::TestCases::new();
t.pass("tests/classes_macro/*-pass.rs");
Expand Down
44 changes: 18 additions & 26 deletions packages/yew-macro/tests/derive_props/fail.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -61,22 +61,14 @@ help: consider annotating `Value` with `#[derive(PartialEq)]`
9 | struct Value;
|

error[E0277]: the trait bound `AssertAllProps: HasProp<t3::_Props::value, _>` is not satisfied
error[E0277]: not all required properties have been provided
--> tests/derive_props/fail.rs:35:24
|
35 | ::yew::props!{ Props { } };
| ^^^^^ the trait `HasProp<t3::_Props::value, _>` is not implemented for `AssertAllProps`
|
= help: the following other types implement trait `HasProp<P, How>`:
<t1::CheckPropsAll<B> as HasProp<P, &dyn HasProp<P, How>>>
<t2::HasPropsvalue<B> as HasProp<t2::_Props::value, t2::HasPropsvalue<B>>>
<t2::HasPropsvalue<B> as HasProp<P, &dyn HasProp<P, How>>>
<t2::CheckPropsAll<B> as HasProp<P, &dyn HasProp<P, How>>>
<t3::HasPropsvalue<B> as HasProp<t3::_Props::value, t3::HasPropsvalue<B>>>
<t3::HasPropsvalue<B> as HasProp<P, &dyn HasProp<P, How>>>
<t3::CheckPropsAll<B> as HasProp<P, &dyn HasProp<P, How>>>
<t4::HasPropsvalue<B> as HasProp<t4::_Props::value, t4::HasPropsvalue<B>>>
and $N others
| ^^^^^ missing required properties for this component
|
= help: the trait `HasProp<t3::_Props::value, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<t3::PropsBuilder, _>`
= note: make sure all required properties are set before building the component
note: required for `t3::CheckPropsAll<AssertAllProps>` to implement `HasAllProps<t3::Props, (_,)>`
--> tests/derive_props/fail.rs:29:21
|
Expand All @@ -93,22 +85,14 @@ note: required by a bound in `html::component::properties::__macro::PreBuild::<T
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `PreBuild::<Token, B>::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 `AssertAllProps: HasProp<t4::_Props::value, _>` is not satisfied
error[E0277]: not all required properties have been provided
--> tests/derive_props/fail.rs:47:24
|
47 | ::yew::props!{ Props { } };
| ^^^^^ the trait `HasProp<t4::_Props::value, _>` is not implemented for `AssertAllProps`
|
= help: the following other types implement trait `HasProp<P, How>`:
<t1::CheckPropsAll<B> as HasProp<P, &dyn HasProp<P, How>>>
<t2::HasPropsvalue<B> as HasProp<t2::_Props::value, t2::HasPropsvalue<B>>>
<t2::HasPropsvalue<B> as HasProp<P, &dyn HasProp<P, How>>>
<t2::CheckPropsAll<B> as HasProp<P, &dyn HasProp<P, How>>>
<t3::HasPropsvalue<B> as HasProp<t3::_Props::value, t3::HasPropsvalue<B>>>
<t3::HasPropsvalue<B> as HasProp<P, &dyn HasProp<P, How>>>
<t3::CheckPropsAll<B> as HasProp<P, &dyn HasProp<P, How>>>
<t4::HasPropsvalue<B> as HasProp<t4::_Props::value, t4::HasPropsvalue<B>>>
and $N others
| ^^^^^ missing required properties for this component
|
= help: the trait `HasProp<t4::_Props::value, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<t4::PropsBuilder, _>`
= note: make sure all required properties are set before building the component
note: required for `t4::CheckPropsAll<AssertAllProps>` to implement `HasAllProps<t4::Props, (_,)>`
--> tests/derive_props/fail.rs:41:21
|
Expand Down Expand Up @@ -168,3 +152,11 @@ error[E0271]: expected `foo` to be a fn item that returns `String`, but it retur
|
note: required by a bound in `Option::<T>::unwrap_or_else`
--> $RUST/core/src/option.rs

warning: unused variable: `bar`
--> tests/derive_props/fail.rs:100:12
|
100 | fn foo(bar: i32) -> String {
| ^^^ help: if this is intentional, prefix it with an underscore: `_bar`
|
= note: `#[warn(unused_variables)]` on by default
1 change: 0 additions & 1 deletion packages/yew-macro/tests/derive_props/pass.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![no_implicit_prelude]
#![recursion_limit = "128"]

// Shadow primitives
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/tests/derive_props_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[allow(dead_code)]
#[rustversion::attr(stable(1.76), test)]
#[rustversion::attr(stable(1.78), test)]
fn derive_props() {
let t = trybuild::TestCases::new();
t.pass("tests/derive_props/pass.rs");
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/tests/function_attr_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[allow(dead_code)]
#[rustversion::attr(stable(1.76), test)]
#[rustversion::attr(stable(1.78), test)]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/function_component_attr/*-pass.rs");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![no_implicit_prelude]

// Shadow primitives
#[allow(non_camel_case_types)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,14 @@ help: you might be missing a type parameter
20 | fn compile_fail<INVALID>() {
| +++++++++

error[E0277]: the trait bound `AssertAllProps: HasProp<a, _>` is not satisfied
error[E0277]: not all required properties have been provided
--> tests/function_component_attr/generic-props-fail.rs:22:14
|
22 | html! { <Comp<Props> /> };
| ^^^^ the trait `HasProp<a, _>` is not implemented for `AssertAllProps`
|
= help: the following other types implement trait `HasProp<P, How>`:
<HasPropsa<B> as HasProp<a, HasPropsa<B>>>
<HasPropsa<B> as HasProp<P, &dyn HasProp<P, How>>>
<CheckPropsAll<B> as HasProp<P, &dyn HasProp<P, How>>>
<HasContextProviderPropscontext<B> as HasProp<yew::context::_ContextProviderProps::context, HasContextProviderPropscontext<B>>>
<HasContextProviderPropscontext<B> as HasProp<P, &dyn HasProp<P, How>>>
<HasContextProviderPropschildren<B> as HasProp<children, HasContextProviderPropschildren<B>>>
<HasContextProviderPropschildren<B> as HasProp<P, &dyn HasProp<P, How>>>
<CheckContextProviderPropsAll<B> as HasProp<P, &dyn HasProp<P, How>>>
and $N others
| ^^^^ missing required properties for this component
|
= help: the trait `HasProp<a, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<PropsBuilder, _>`
= note: make sure all required properties are set before building the component
note: required for `CheckPropsAll<AssertAllProps>` to implement `HasAllProps<Props, (_,)>`
--> tests/function_component_attr/generic-props-fail.rs:3:17
|
Expand Down Expand Up @@ -80,6 +72,11 @@ error[E0599]: the function or associated item `new` exists for struct `VChild<Co
27 | html! { <Comp<MissingTypeBounds> /> };
| ^^^^ function or associated item cannot be called on `VChild<Comp<MissingTypeBounds>>` due to unsatisfied trait bounds
|
note: if you're trying to build a new `VChild<Comp<MissingTypeBounds>>`, consider using `VChild::<COMP>::new` which returns `VChild<_>`
--> $WORKSPACE/packages/yew/src/virtual_dom/vcomp.rs
|
| pub fn new(props: COMP::Properties, key: Option<Key>) -> Self {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
= note: the following trait bounds were not satisfied:
`Comp<MissingTypeBounds>: yew::BaseComponent`
note: the trait `yew::BaseComponent` must be implemented
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![no_implicit_prelude]

#[derive(
::std::prelude::rust_2021::Debug,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![no_implicit_prelude]

#[derive(::yew::prelude::Properties, ::std::prelude::rust_2021::PartialEq,)]
struct Props {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#![no_implicit_prelude]
Copy link
Member Author

@Madoshakalaka Madoshakalaka Jul 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed these from the tests that have #[derive(Properties)] because it prevents #[diagnostics] from being used. I have no clue how to qualify diagnostics with no_implicit_prelude. If anybody can help it's very appreciated.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm.. I think it's impossible to use no_implicit_prelude together with diagnostic

https://doc.rust-lang.org/reference/attributes.html#r-attributes.tool.prelude

Tool attributes are not available if the no_implicit_prelude attribute is used.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think no_implicit_prelude was introduced to improve hygiene, it ensures our macros don't accidentally collide with rust's built-in ones, which could cause false passes in macro tests.

Sadly there seems to be no way around it for now and diagnostic improvements seem worth it.


#[derive(::yew::prelude::Properties, ::std::fmt::Debug)]
pub struct CompProps<A> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#![no_implicit_prelude]

// Shadow primitives
#[allow(non_camel_case_types)]
pub struct bool;
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/tests/hook_attr_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[allow(dead_code)]
#[rustversion::attr(stable(1.76), test)]
#[rustversion::attr(stable(1.78), test)]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/hook_attr/*-pass.rs");
Expand Down
2 changes: 1 addition & 1 deletion packages/yew-macro/tests/hook_macro_test.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#[allow(dead_code)]
#[rustversion::attr(stable(1.76), test)]
#[rustversion::attr(stable(1.78), test)]
fn tests() {
let t = trybuild::TestCases::new();
t.pass("tests/hook_macro/*-pass.rs");
Expand Down
12 changes: 4 additions & 8 deletions packages/yew-macro/tests/html_macro/block-fail.stderr
Original file line number Diff line number Diff line change
@@ -1,28 +1,24 @@
error[E0277]: `()` doesn't implement `std::fmt::Display`
error[E0277]: the trait bound `(): Into<NodeSeq<(), VNode>>` is not satisfied
--> tests/html_macro/block-fail.rs:6:15
|
6 | { () }
| ^^
| |
| `()` cannot be formatted with the default formatter
| the trait `std::fmt::Display` is not implemented for `()`, which is required by `(): Into<NodeSeq<_, _>>`
| required by a bound introduced by this call
|
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: required for `()` to implement `ToString`
= note: required for `VNode` to implement `From<()>`
= note: required for `()` to implement `Into<VNode>`
= note: 2 redundant requirements hidden
= note: required for `()` to implement `Into<NodeSeq<(), VNode>>`

error[E0277]: `()` doesn't implement `std::fmt::Display`
error[E0277]: the trait bound `(): Into<VNode>` is not satisfied
--> tests/html_macro/block-fail.rs:15:17
|
15 | <>{ for (0..3).map(|_| not_tree()) }</>
| ^^^^^^ `()` cannot be formatted with the default formatter
| ^^^^^^ the trait `std::fmt::Display` is not implemented for `()`, which is required by `(): Into<_>`
|
= help: the trait `std::fmt::Display` is not implemented for `()`
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
= note: required for `()` to implement `ToString`
= note: required for `VNode` to implement `From<()>`
= note: required for `()` to implement `Into<VNode>`
Expand Down
Loading
Loading