mirror of
https://github.com/yewstack/yew.git
synced 2025-12-08 21:26:25 +00:00
concise diagnostics for missing props (#3873)
This commit is contained in:
parent
4d08a03355
commit
b4d083ef8f
4
.github/workflows/main-checks.yml
vendored
4
.github/workflows/main-checks.yml
vendored
@ -69,7 +69,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
toolchain:
|
||||
- 1.76.0
|
||||
- 1.78.0
|
||||
- stable
|
||||
|
||||
steps:
|
||||
@ -120,7 +120,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
toolchain:
|
||||
- 1.76.0
|
||||
- 1.78.0
|
||||
- stable
|
||||
- nightly
|
||||
|
||||
|
||||
@ -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(())
|
||||
}
|
||||
|
||||
@ -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}"));
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
@ -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 <futursolo@icloud.com>"]
|
||||
repository = "https://github.com/yewstack/yew"
|
||||
homepage = "https://yew.rs"
|
||||
|
||||
@ -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" }
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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", "${@}"]
|
||||
|
||||
@ -142,11 +142,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 , )* ),
|
||||
|
||||
@ -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> {}
|
||||
|
||||
@ -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>>>
|
||||
@ -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>>>
|
||||
@ -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>>>
|
||||
@ -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>>>
|
||||
@ -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>>>
|
||||
@ -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>>>
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -61,22 +61,13 @@ 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`
|
||||
| ^^^^^ missing required properties for this component
|
||||
|
|
||||
= 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
|
||||
= help: the trait `HasProp<t3::_Props::value, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<t3::PropsBuilder, _>`
|
||||
note: required for `t3::CheckPropsAll<AssertAllProps>` to implement `HasAllProps<t3::Props, (_,)>`
|
||||
--> tests/derive_props/fail.rs:29:21
|
||||
|
|
||||
@ -93,22 +84,13 @@ 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`
|
||||
| ^^^^^ missing required properties for this component
|
||||
|
|
||||
= 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
|
||||
= help: the trait `HasProp<t4::_Props::value, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<t4::PropsBuilder, _>`
|
||||
note: required for `t4::CheckPropsAll<AssertAllProps>` to implement `HasAllProps<t4::Props, (_,)>`
|
||||
--> tests/derive_props/fail.rs:41:21
|
||||
|
|
||||
@ -168,3 +150,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,4 +1,3 @@
|
||||
#![no_implicit_prelude]
|
||||
#![recursion_limit = "128"]
|
||||
|
||||
// Shadow primitives
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#![no_implicit_prelude]
|
||||
|
||||
// Shadow primitives
|
||||
#[allow(non_camel_case_types)]
|
||||
|
||||
@ -9,22 +9,13 @@ 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`
|
||||
| ^^^^ missing required properties for this component
|
||||
|
|
||||
= 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
|
||||
= help: the trait `HasProp<a, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<PropsBuilder, _>`
|
||||
note: required for `CheckPropsAll<AssertAllProps>` to implement `HasAllProps<Props, (_,)>`
|
||||
--> tests/function_component_attr/generic-props-fail.rs:3:17
|
||||
|
|
||||
@ -80,6 +71,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
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#![no_implicit_prelude]
|
||||
|
||||
#[derive(
|
||||
::std::prelude::rust_2021::Debug,
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#![no_implicit_prelude]
|
||||
|
||||
#[derive(::yew::prelude::Properties, ::std::prelude::rust_2021::PartialEq,)]
|
||||
struct Props {
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#![no_implicit_prelude]
|
||||
|
||||
#[derive(::yew::prelude::Properties, ::std::fmt::Debug)]
|
||||
pub struct CompProps<A> {
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
#![no_implicit_prelude]
|
||||
|
||||
// Shadow primitives
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct bool;
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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");
|
||||
|
||||
@ -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>`
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
#![no_implicit_prelude]
|
||||
|
||||
// Shadow primitives
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct bool;
|
||||
|
||||
@ -436,7 +436,10 @@ error[E0599]: no method named `r#type` found for struct `ChildPropertiesBuilder`
|
||||
| ---------- method `r#type` not found for this struct
|
||||
...
|
||||
85 | html! { <Child type=0 /> };
|
||||
| ^^^^ method not found in `ChildPropertiesBuilder`
|
||||
| ^^^^
|
||||
|
|
||||
help: there is a method `type_id` with a similar name, but with different arguments
|
||||
--> $RUST/core/src/any.rs
|
||||
|
||||
error[E0609]: no field `unknown` on type `ChildProperties`
|
||||
--> tests/html_macro/component-fail.rs:88:20
|
||||
@ -568,22 +571,13 @@ note: required by a bound in `ChildPropertiesBuilder::int`
|
||||
| --- required by a bound in this associated function
|
||||
= 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<int, _>` is not satisfied
|
||||
error[E0277]: not all required properties have been provided
|
||||
--> tests/html_macro/component-fail.rs:99:14
|
||||
|
|
||||
99 | html! { <Child string="abc" /> };
|
||||
| ^^^^^ the trait `HasProp<int, _>` is not implemented for `AssertAllProps`
|
||||
| ^^^^^ missing required properties for this component
|
||||
|
|
||||
= help: the following other types implement trait `HasProp<P, How>`:
|
||||
<HasChildPropertiesint<B> as HasProp<int, HasChildPropertiesint<B>>>
|
||||
<HasChildPropertiesint<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<CheckChildPropertiesAll<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<HasChildContainerPropertieschildren<B> as HasProp<_ChildContainerProperties::children, HasChildContainerPropertieschildren<B>>>
|
||||
<HasChildContainerPropertieschildren<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<CheckChildContainerPropertiesAll<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<HasHtmlInPropsPropertiesheader<B> as HasProp<header, HasHtmlInPropsPropertiesheader<B>>>
|
||||
<HasHtmlInPropsPropertiesheader<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
and $N others
|
||||
= help: the trait `HasProp<int, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<ChildPropertiesBuilder, _>`
|
||||
note: required for `CheckChildPropertiesAll<AssertAllProps>` to implement `HasAllProps<ChildProperties, (_,)>`
|
||||
--> tests/html_macro/component-fail.rs:4:17
|
||||
|
|
||||
@ -627,22 +621,13 @@ error[E0609]: no field `children` on type `ChildProperties`
|
||||
|
|
||||
= note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: the trait bound `AssertAllProps: HasProp<_ChildContainerProperties::children, _>` is not satisfied
|
||||
error[E0277]: not all required properties have been provided
|
||||
--> tests/html_macro/component-fail.rs:115:14
|
||||
|
|
||||
115 | html! { <ChildContainer /> };
|
||||
| ^^^^^^^^^^^^^^ the trait `HasProp<_ChildContainerProperties::children, _>` is not implemented for `AssertAllProps`
|
||||
| ^^^^^^^^^^^^^^ missing required properties for this component
|
||||
|
|
||||
= help: the following other types implement trait `HasProp<P, How>`:
|
||||
<HasChildPropertiesint<B> as HasProp<int, HasChildPropertiesint<B>>>
|
||||
<HasChildPropertiesint<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<CheckChildPropertiesAll<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<HasChildContainerPropertieschildren<B> as HasProp<_ChildContainerProperties::children, HasChildContainerPropertieschildren<B>>>
|
||||
<HasChildContainerPropertieschildren<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<CheckChildContainerPropertiesAll<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<HasHtmlInPropsPropertiesheader<B> as HasProp<header, HasHtmlInPropsPropertiesheader<B>>>
|
||||
<HasHtmlInPropsPropertiesheader<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
and $N others
|
||||
= help: the trait `HasProp<_ChildContainerProperties::children, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<ChildContainerPropertiesBuilder, _>`
|
||||
note: required for `CheckChildContainerPropertiesAll<AssertAllProps>` to implement `HasAllProps<ChildContainerProperties, (_,)>`
|
||||
--> tests/html_macro/component-fail.rs:24:17
|
||||
|
|
||||
@ -659,22 +644,13 @@ note: required by a bound in `yew::html::component::properties::__macro::PreBuil
|
||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `PreBuild::<Token, B>::build`
|
||||
= 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
|
||||
error[E0277]: not all required properties have been provided
|
||||
--> tests/html_macro/component-fail.rs:116:14
|
||||
|
|
||||
116 | html! { <ChildContainer></ChildContainer> };
|
||||
| ^^^^^^^^^^^^^^ the trait `HasProp<_ChildContainerProperties::children, _>` is not implemented for `AssertAllProps`
|
||||
| ^^^^^^^^^^^^^^ missing required properties for this component
|
||||
|
|
||||
= help: the following other types implement trait `HasProp<P, How>`:
|
||||
<HasChildPropertiesint<B> as HasProp<int, HasChildPropertiesint<B>>>
|
||||
<HasChildPropertiesint<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<CheckChildPropertiesAll<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<HasChildContainerPropertieschildren<B> as HasProp<_ChildContainerProperties::children, HasChildContainerPropertieschildren<B>>>
|
||||
<HasChildContainerPropertieschildren<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<CheckChildContainerPropertiesAll<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<HasHtmlInPropsPropertiesheader<B> as HasProp<header, HasHtmlInPropsPropertiesheader<B>>>
|
||||
<HasHtmlInPropsPropertiesheader<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
and $N others
|
||||
= help: the trait `HasProp<_ChildContainerProperties::children, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<ChildContainerPropertiesBuilder, _>`
|
||||
note: required for `CheckChildContainerPropertiesAll<AssertAllProps>` to implement `HasAllProps<ChildContainerProperties, (_,)>`
|
||||
--> tests/html_macro/component-fail.rs:24:17
|
||||
|
|
||||
@ -716,7 +692,7 @@ error[E0277]: the trait bound `VChild<Child>: From<VNode>` is not satisfied
|
||||
--> tests/html_macro/component-fail.rs:118:29
|
||||
|
|
||||
118 | html! { <ChildContainer><></></ChildContainer> };
|
||||
| ^ the trait `From<VNode>` is not implemented for `VChild<Child>`
|
||||
| ^ the trait `From<VNode>` is not implemented for `VChild<Child>`, which is required by `VNode: Into<_>`
|
||||
|
|
||||
= note: required for `VNode` to implement `Into<VChild<Child>>`
|
||||
|
||||
@ -739,3 +715,11 @@ note: required by a bound in `ChildContainerPropertiesBuilder::children`
|
||||
26 | pub children: ChildrenWithProps<Child>,
|
||||
| -------- required by a bound in this associated function
|
||||
= note: this error originates in the derive macro `Properties` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
warning: unused variable: `props`
|
||||
--> tests/html_macro/component-fail.rs:144:16
|
||||
|
|
||||
144 | fn HtmlInProps(props: &HtmlInPropsProperties) -> Html { let _ = (); unimplemented!() }
|
||||
| ^^^^^ help: if this is intentional, prefix it with an underscore: `_props`
|
||||
|
|
||||
= note: `#[warn(unused_variables)]` on by default
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
#![no_implicit_prelude]
|
||||
|
||||
// Shadow primitives
|
||||
#[allow(non_camel_case_types)]
|
||||
pub struct bool;
|
||||
|
||||
@ -2,7 +2,7 @@ error[E0277]: the trait bound `Unimplemented: yew::Component` is not satisfied
|
||||
--> tests/html_macro/component-unimplemented-fail.rs:6:14
|
||||
|
|
||||
6 | html! { <Unimplemented /> };
|
||||
| ^^^^^^^^^^^^^ the trait `yew::Component` is not implemented for `Unimplemented`
|
||||
| ^^^^^^^^^^^^^ the trait `yew::Component` is not implemented for `Unimplemented`, which is required by `Unimplemented: BaseComponent`
|
||||
|
|
||||
= help: the trait `yew::Component` is implemented for `ContextProvider<T>`
|
||||
= note: required for `Unimplemented` to implement `BaseComponent`
|
||||
@ -17,6 +17,11 @@ error[E0599]: the function or associated item `new` exists for struct `VChild<Un
|
||||
6 | html! { <Unimplemented /> };
|
||||
| ^^^^^^^^^^^^^ function or associated item cannot be called on `VChild<Unimplemented>` due to unsatisfied trait bounds
|
||||
|
|
||||
note: if you're trying to build a new `VChild<Unimplemented>`, 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:
|
||||
`Unimplemented: BaseComponent`
|
||||
note: the trait `BaseComponent` must be implemented
|
||||
|
||||
@ -510,16 +510,15 @@ error[E0277]: the trait bound `Option<{integer}>: IntoPropValue<Option<implicit_
|
||||
<Option<&'static str> as IntoPropValue<Option<String>>>
|
||||
<Option<F> as IntoPropValue<Option<yew::Callback<I, O>>>>
|
||||
|
||||
error[E0277]: expected a `Fn(MouseEvent)` closure, found `{integer}`
|
||||
error[E0277]: the trait bound `{integer}: IntoEventCallback<MouseEvent>` is not satisfied
|
||||
--> tests/html_macro/element-fail.rs:51:28
|
||||
|
|
||||
51 | html! { <input onclick=1 /> };
|
||||
| -----------------------^-----
|
||||
| | |
|
||||
| | expected an `Fn(MouseEvent)` closure, found `{integer}`
|
||||
| | the trait `Fn<(MouseEvent,)>` is not implemented for `{integer}`, which is required by `{integer}: IntoEventCallback<MouseEvent>`
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Fn<(MouseEvent,)>` is not implemented for `{integer}`
|
||||
= help: the following other types implement trait `IntoEventCallback<EVENT>`:
|
||||
yew::Callback<EVENT>
|
||||
Option<yew::Callback<EVENT>>
|
||||
@ -542,18 +541,19 @@ note: required by a bound in `yew::html::onclick::Wrapper::__macro_new`
|
||||
| required by this bound in `Wrapper::__macro_new`
|
||||
= note: this error originates in the macro `impl_action` which comes from the expansion of the macro `impl_short` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
error[E0277]: expected a `Fn(MouseEvent)` closure, found `yew::Callback<String>`
|
||||
error[E0277]: the trait bound `yew::Callback<String>: IntoEventCallback<MouseEvent>` is not satisfied
|
||||
--> tests/html_macro/element-fail.rs:52:29
|
||||
|
|
||||
52 | html! { <input onclick={Callback::from(|a: String| ())} /> };
|
||||
| ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------
|
||||
| | |
|
||||
| | expected an `Fn(MouseEvent)` closure, found `yew::Callback<String>`
|
||||
| | the trait `Fn<(MouseEvent,)>` is not implemented for `yew::Callback<String>`, which is required by `yew::Callback<String>: IntoEventCallback<MouseEvent>`
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Fn<(MouseEvent,)>` is not implemented for `yew::Callback<String>`
|
||||
= help: the following other types implement trait `IntoEventCallback<EVENT>`:
|
||||
yew::Callback<EVENT>
|
||||
Option<yew::Callback<EVENT>>
|
||||
Option<T>
|
||||
&yew::Callback<EVENT>
|
||||
= note: required for `yew::Callback<String>` to implement `IntoEventCallback<MouseEvent>`
|
||||
note: required by a bound in `yew::html::onclick::Wrapper::__macro_new`
|
||||
@ -631,18 +631,19 @@ error[E0277]: the trait bound `Option<yew::NodeRef>: IntoPropValue<yew::NodeRef>
|
||||
<Option<&'static str> as IntoPropValue<Option<String>>>
|
||||
<Option<F> as IntoPropValue<Option<yew::Callback<I, O>>>>
|
||||
|
||||
error[E0277]: expected a `Fn(MouseEvent)` closure, found `yew::Callback<String>`
|
||||
error[E0277]: the trait bound `yew::Callback<String>: IntoEventCallback<MouseEvent>` is not satisfied
|
||||
--> tests/html_macro/element-fail.rs:58:29
|
||||
|
|
||||
58 | html! { <input onclick={Callback::from(|a: String| ())} /> };
|
||||
| ------------------------^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^------
|
||||
| | |
|
||||
| | expected an `Fn(MouseEvent)` closure, found `yew::Callback<String>`
|
||||
| | the trait `Fn<(MouseEvent,)>` is not implemented for `yew::Callback<String>`, which is required by `yew::Callback<String>: IntoEventCallback<MouseEvent>`
|
||||
| required by a bound introduced by this call
|
||||
|
|
||||
= help: the trait `Fn<(MouseEvent,)>` is not implemented for `yew::Callback<String>`
|
||||
= help: the following other types implement trait `IntoEventCallback<EVENT>`:
|
||||
yew::Callback<EVENT>
|
||||
Option<yew::Callback<EVENT>>
|
||||
Option<T>
|
||||
&yew::Callback<EVENT>
|
||||
= note: required for `yew::Callback<String>` to implement `IntoEventCallback<MouseEvent>`
|
||||
note: required by a bound in `yew::html::onclick::Wrapper::__macro_new`
|
||||
@ -694,7 +695,7 @@ error[E0277]: the trait bound `implicit_clone::unsync::string::IString: From<{in
|
||||
--> tests/html_macro/element-fail.rs:79:16
|
||||
|
|
||||
79 | html! { <@{55}></@> };
|
||||
| ^^ the trait `From<{integer}>` is not implemented for `implicit_clone::unsync::string::IString`
|
||||
| ^^ the trait `From<{integer}>` is not implemented for `implicit_clone::unsync::string::IString`, which is required by `{integer}: Into<implicit_clone::unsync::string::IString>`
|
||||
|
|
||||
= help: the following other types implement trait `From<T>`:
|
||||
<implicit_clone::unsync::string::IString as From<Cow<'static, str>>>
|
||||
|
||||
@ -10,7 +10,7 @@ error[E0277]: `()` is not an iterator
|
||||
5 | html! { for () };
|
||||
| ^^ `()` is not an iterator
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `()`
|
||||
= help: the trait `Iterator` is not implemented for `()`, which is required by `(): IntoIterator`
|
||||
= note: required for `()` to implement `IntoIterator`
|
||||
|
||||
error[E0277]: `()` is not an iterator
|
||||
@ -22,7 +22,7 @@ error[E0277]: `()` is not an iterator
|
||||
| |this tail expression is of type `()`
|
||||
| `()` is not an iterator
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `()`
|
||||
= help: the trait `Iterator` is not implemented for `()`, which is required by `(): IntoIterator`
|
||||
= note: required for `()` to implement `IntoIterator`
|
||||
|
||||
error[E0277]: `()` doesn't implement `std::fmt::Display`
|
||||
@ -31,7 +31,7 @@ error[E0277]: `()` doesn't implement `std::fmt::Display`
|
||||
7 | html! { for Vec::<()>::new().into_iter() };
|
||||
| ^^^ `()` cannot be formatted with the default formatter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`, which is required by `VNode: FromIterator<_>`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
= help: the trait `FromIterator<A>` is implemented for `VNode`
|
||||
= note: required for `()` to implement `ToString`
|
||||
@ -47,7 +47,7 @@ error[E0277]: `()` doesn't implement `std::fmt::Display`
|
||||
10 | html! { for empty };
|
||||
| ^^^^^ `()` cannot be formatted with the default formatter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`, which is required by `VNode: FromIterator<_>`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
= help: the trait `FromIterator<A>` is implemented for `VNode`
|
||||
= note: required for `()` to implement `ToString`
|
||||
@ -63,7 +63,7 @@ error[E0277]: `()` doesn't implement `std::fmt::Display`
|
||||
13 | html! { for empty.iter() };
|
||||
| ^^^^^ `()` cannot be formatted with the default formatter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`, which is required by `VNode: FromIterator<_>`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
= help: the trait `FromIterator<A>` is implemented for `VNode`
|
||||
= note: required for `&()` to implement `std::fmt::Display`
|
||||
@ -80,7 +80,7 @@ error[E0277]: `()` is not an iterator
|
||||
18 | { for () }
|
||||
| ^^ `()` is not an iterator
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `()`
|
||||
= help: the trait `Iterator` is not implemented for `()`, which is required by `(): IntoIterator`
|
||||
= note: required for `()` to implement `IntoIterator`
|
||||
note: required by a bound in `into_node_iter`
|
||||
--> $WORKSPACE/packages/yew/src/utils/mod.rs
|
||||
@ -90,3 +90,26 @@ note: required by a bound in `into_node_iter`
|
||||
| where
|
||||
| IT: IntoIterator<Item = T>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `into_node_iter`
|
||||
|
||||
error[E0277]: `()` is not an iterator
|
||||
--> tests/html_macro/iterable-fail.rs:15:5
|
||||
|
|
||||
15 | / html! {
|
||||
16 | | <>
|
||||
17 | | <div/>
|
||||
18 | | { for () }
|
||||
19 | | </>
|
||||
20 | | };
|
||||
| |_____^ `()` is not an iterator
|
||||
|
|
||||
= help: the trait `Iterator` is not implemented for `()`, which is required by `(): IntoIterator`
|
||||
= note: required for `()` to implement `IntoIterator`
|
||||
note: required by a bound in `into_node_iter`
|
||||
--> $WORKSPACE/packages/yew/src/utils/mod.rs
|
||||
|
|
||||
| pub fn into_node_iter<IT, T, R>(it: IT) -> impl Iterator<Item = R>
|
||||
| -------------- required by a bound in this function
|
||||
| where
|
||||
| IT: IntoIterator<Item = T>,
|
||||
| ^^^^^^^^^^^^^^^^^^^^^^ required by this bound in `into_node_iter`
|
||||
= note: this error originates in the macro `html` (in Nightly builds, run with -Z macro-backtrace for more info)
|
||||
|
||||
@ -0,0 +1,35 @@
|
||||
use yew::prelude::*;
|
||||
|
||||
#[function_component]
|
||||
pub fn App() -> Html {
|
||||
html! {
|
||||
<Foo />
|
||||
}
|
||||
}
|
||||
|
||||
#[function_component]
|
||||
pub fn App1() -> Html {
|
||||
html! {
|
||||
<Foo bar={"bar".to_string()} />
|
||||
}
|
||||
}
|
||||
|
||||
#[function_component]
|
||||
pub fn App2() -> Html {
|
||||
html! {
|
||||
<Foo bar={"bar".to_string()} baz={42} />
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Properties, PartialEq, Clone)]
|
||||
pub struct FooProps {
|
||||
pub bar: String,
|
||||
pub baz: u32,
|
||||
}
|
||||
|
||||
#[function_component]
|
||||
pub fn Foo(_props: &FooProps) -> Html {
|
||||
html! {}
|
||||
}
|
||||
|
||||
fn main() {}
|
||||
@ -0,0 +1,83 @@
|
||||
error[E0277]: not all required properties have been provided
|
||||
--> tests/html_macro/missing-props-diagnostics-fail.rs:6:10
|
||||
|
|
||||
6 | <Foo />
|
||||
| ^^^ missing required properties for this component
|
||||
|
|
||||
= help: the trait `HasProp<bar, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<FooPropsBuilder, _>`
|
||||
note: required for `CheckFooPropsAll<AssertAllProps>` to implement `HasAllProps<FooProps, (_, _)>`
|
||||
--> tests/html_macro/missing-props-diagnostics-fail.rs:24:10
|
||||
|
|
||||
24 | #[derive(Properties, PartialEq, Clone)]
|
||||
| ^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: required for `AssertAllProps` to implement `AllPropsFor<FooPropsBuilder, (_, _)>`
|
||||
note: required by a bound in `yew::html::component::properties::__macro::PreBuild::<Token, B>::build`
|
||||
--> $WORKSPACE/packages/yew/src/html/component/properties.rs
|
||||
|
|
||||
| pub fn build<How>(self) -> B::Output
|
||||
| ----- required by a bound in this associated function
|
||||
| where
|
||||
| Token: AllPropsFor<B, How>,
|
||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `PreBuild::<Token, B>::build`
|
||||
= 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]: not all required properties have been provided
|
||||
--> tests/html_macro/missing-props-diagnostics-fail.rs:6:10
|
||||
|
|
||||
6 | <Foo />
|
||||
| ^^^ missing required properties for this component
|
||||
|
|
||||
= help: the trait `HasProp<baz, _>` is not implemented for `AssertAllProps`, which is required by `AssertAllProps: AllPropsFor<FooPropsBuilder, _>`
|
||||
note: required for `CheckFooPropsAll<AssertAllProps>` to implement `HasAllProps<FooProps, (_, _)>`
|
||||
--> tests/html_macro/missing-props-diagnostics-fail.rs:24:10
|
||||
|
|
||||
24 | #[derive(Properties, PartialEq, Clone)]
|
||||
| ^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: required for `AssertAllProps` to implement `AllPropsFor<FooPropsBuilder, (_, _)>`
|
||||
note: required by a bound in `yew::html::component::properties::__macro::PreBuild::<Token, B>::build`
|
||||
--> $WORKSPACE/packages/yew/src/html/component/properties.rs
|
||||
|
|
||||
| pub fn build<How>(self) -> B::Output
|
||||
| ----- required by a bound in this associated function
|
||||
| where
|
||||
| Token: AllPropsFor<B, How>,
|
||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `PreBuild::<Token, B>::build`
|
||||
= 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]: property `baz` is required but not provided
|
||||
--> tests/html_macro/missing-props-diagnostics-fail.rs:13:10
|
||||
|
|
||||
13 | <Foo bar={"bar".to_string()} />
|
||||
| ^^^ missing required property `baz`
|
||||
|
|
||||
= help: the trait `HasProp<baz, _>` is not implemented for `AssertAllProps`, which is required by `HasFooPropsbar<AssertAllProps>: AllPropsFor<FooPropsBuilder, _>`
|
||||
= help: the following other types implement trait `HasProp<P, How>`:
|
||||
<HasFooPropsbar<B> as HasProp<bar, HasFooPropsbar<B>>>
|
||||
<HasFooPropsbar<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<HasFooPropsbaz<B> as HasProp<baz, HasFooPropsbaz<B>>>
|
||||
<HasFooPropsbaz<B> as HasProp<P, &dyn HasProp<P, How>>>
|
||||
<CheckFooPropsAll<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>>>
|
||||
and $N others
|
||||
note: required for `HasFooPropsbar<AssertAllProps>` to implement `HasProp<baz, &dyn HasProp<baz, _>>`
|
||||
--> tests/html_macro/missing-props-diagnostics-fail.rs:24:10
|
||||
|
|
||||
24 | #[derive(Properties, PartialEq, Clone)]
|
||||
| ^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
note: required for `CheckFooPropsAll<HasFooPropsbar<AssertAllProps>>` to implement `HasAllProps<FooProps, (HasFooPropsbar<AssertAllProps>, &dyn HasProp<baz, _>)>`
|
||||
--> tests/html_macro/missing-props-diagnostics-fail.rs:24:10
|
||||
|
|
||||
24 | #[derive(Properties, PartialEq, Clone)]
|
||||
| ^^^^^^^^^^ unsatisfied trait bound introduced in this `derive` macro
|
||||
= note: required for `HasFooPropsbar<AssertAllProps>` to implement `AllPropsFor<FooPropsBuilder, (HasFooPropsbar<AssertAllProps>, &dyn HasProp<baz, _>)>`
|
||||
note: required by a bound in `yew::html::component::properties::__macro::PreBuild::<Token, B>::build`
|
||||
--> $WORKSPACE/packages/yew/src/html/component/properties.rs
|
||||
|
|
||||
| pub fn build<How>(self) -> B::Output
|
||||
| ----- required by a bound in this associated function
|
||||
| where
|
||||
| Token: AllPropsFor<B, How>,
|
||||
| ^^^^^^^^^^^^^^^^^^^ required by this bound in `PreBuild::<Token, B>::build`
|
||||
= 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)
|
||||
@ -29,13 +29,6 @@ error[E0425]: cannot find value `invalid` in this scope
|
||||
|
|
||||
7 | html! { invalid };
|
||||
| ^^^^^^^ not found in this scope
|
||||
|
|
||||
help: consider importing one of these items
|
||||
|
|
||||
1 + use core::ptr::invalid;
|
||||
|
|
||||
1 + use std::ptr::invalid;
|
||||
|
|
||||
|
||||
error[E0277]: `()` doesn't implement `std::fmt::Display`
|
||||
--> tests/html_macro/node-fail.rs:6:13
|
||||
@ -43,7 +36,7 @@ error[E0277]: `()` doesn't implement `std::fmt::Display`
|
||||
6 | html! { () };
|
||||
| ^^ `()` cannot be formatted with the default formatter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`, which is required by `VNode: From<()>`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
= help: the following other types implement trait `From<T>`:
|
||||
<VNode as From<yew::virtual_dom::VComp>>
|
||||
@ -65,7 +58,7 @@ error[E0277]: `()` doesn't implement `std::fmt::Display`
|
||||
17 | not_node()
|
||||
| ^^^^^^^^ `()` cannot be formatted with the default formatter
|
||||
|
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`
|
||||
= help: the trait `std::fmt::Display` is not implemented for `()`, which is required by `VNode: From<()>`
|
||||
= note: in format strings you may be able to use `{:?}` (or {:#?} for pretty-print) instead
|
||||
= help: the following other types implement trait `From<T>`:
|
||||
<VNode as From<yew::virtual_dom::VComp>>
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
use yew::{html, html_nested};
|
||||
|
||||
#[allow(dead_code)]
|
||||
#[rustversion::attr(stable(1.76), test)]
|
||||
#[rustversion::attr(stable(1.78), test)]
|
||||
fn html_macro() {
|
||||
let t = trybuild::TestCases::new();
|
||||
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#![no_implicit_prelude]
|
||||
|
||||
// Shadow primitives
|
||||
#[allow(non_camel_case_types)]
|
||||
|
||||
@ -22,7 +22,7 @@ error[E0277]: can't compare `Props` with `Props`
|
||||
9 | type Properties = Props;
|
||||
| ^^^^^ no implementation for `Props == Props`
|
||||
|
|
||||
= help: the trait `PartialEq` is not implemented for `Props`
|
||||
= help: the trait `PartialEq` is not implemented for `Props`, which is required by `<MyComp as yew::Component>::Properties: yew::Properties`
|
||||
= help: the following other types implement trait `yew::Properties`:
|
||||
Props
|
||||
ContextProviderProps<T>
|
||||
@ -40,3 +40,52 @@ help: consider annotating `Props` with `#[derive(PartialEq)]`
|
||||
4 + #[derive(PartialEq)]
|
||||
5 | struct Props {}
|
||||
|
|
||||
|
||||
error[E0277]: the trait bound `Vec<_>: yew::Properties` is not satisfied
|
||||
--> tests/props_macro/resolve-prop-fail.rs:29:17
|
||||
|
|
||||
29 | yew::props!(Vec<_> {});
|
||||
| ^^^^^^ the trait `yew::Properties` is not implemented for `Vec<_>`
|
||||
|
|
||||
= help: the following other types implement trait `yew::Properties`:
|
||||
Props
|
||||
ContextProviderProps<T>
|
||||
ChildrenProps
|
||||
SuspenseProps
|
||||
()
|
||||
|
||||
error[E0277]: the trait bound `Vec<_>: yew::Properties` is not satisfied
|
||||
--> tests/props_macro/resolve-prop-fail.rs:29:17
|
||||
|
|
||||
29 | yew::props!(Vec<_> {});
|
||||
| ^^^ the trait `yew::Properties` is not implemented for `Vec<_>`
|
||||
|
|
||||
= help: the following other types implement trait `yew::Properties`:
|
||||
Props
|
||||
ContextProviderProps<T>
|
||||
ChildrenProps
|
||||
SuspenseProps
|
||||
()
|
||||
|
||||
error[E0277]: the trait bound `MyComp: yew::Properties` is not satisfied
|
||||
--> tests/props_macro/resolve-prop-fail.rs:30:17
|
||||
|
|
||||
30 | yew::props!(MyComp {});
|
||||
| ^^^^^^ the trait `yew::Properties` is not implemented for `MyComp`
|
||||
|
|
||||
= help: the following other types implement trait `yew::Properties`:
|
||||
Props
|
||||
ContextProviderProps<T>
|
||||
ChildrenProps
|
||||
SuspenseProps
|
||||
()
|
||||
|
||||
error[E0277]: the trait bound `MyNotAComponent: yew::Component` is not satisfied
|
||||
--> tests/props_macro/resolve-prop-fail.rs:31:17
|
||||
|
|
||||
31 | yew::props!(MyNotAComponent::Properties {});
|
||||
| ^^^^^^^^^^^^^^^ the trait `yew::Component` is not implemented for `MyNotAComponent`
|
||||
|
|
||||
= help: the following other types implement trait `yew::Component`:
|
||||
MyComp
|
||||
ContextProvider<T>
|
||||
|
||||
@ -1,4 +1,3 @@
|
||||
#![no_implicit_prelude]
|
||||
|
||||
// Shadow primitives
|
||||
#[allow(non_camel_case_types)]
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
#[allow(dead_code)]
|
||||
#[rustversion::attr(stable(1.76), test)]
|
||||
#[rustversion::attr(stable(1.78), test)]
|
||||
fn props_macro() {
|
||||
let t = trybuild::TestCases::new();
|
||||
t.pass("tests/props_macro/*-pass.rs");
|
||||
|
||||
@ -6,7 +6,7 @@ edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
description = "Contains macros used with yew-router"
|
||||
repository = "https://github.com/yewstack/yew"
|
||||
rust-version = "1.76.0"
|
||||
rust-version = "1.78.0"
|
||||
|
||||
[lib]
|
||||
proc-macro = true
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
[tasks.test]
|
||||
clear = true
|
||||
toolchain = "1.76.0"
|
||||
toolchain = "1.78.0"
|
||||
command = "cargo"
|
||||
args = ["test"]
|
||||
|
||||
|
||||
@ -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/routable_derive/*-pass.rs");
|
||||
|
||||
@ -9,7 +9,7 @@ keywords = ["web", "yew", "router"]
|
||||
categories = ["gui", "web-programming"]
|
||||
description = "A router implementation for the Yew framework"
|
||||
repository = "https://github.com/yewstack/yew"
|
||||
rust-version = "1.76.0"
|
||||
rust-version = "1.78.0"
|
||||
|
||||
[dependencies]
|
||||
yew = { version = "0.21.0", path = "../yew", default-features= false }
|
||||
|
||||
@ -14,7 +14,7 @@ keywords = ["web", "webasm", "javascript"]
|
||||
categories = ["gui", "wasm", "web-programming"]
|
||||
description = "A framework for creating reliable and efficient web applications"
|
||||
readme = "../../README.md"
|
||||
rust-version = "1.76.0"
|
||||
rust-version = "1.78.0"
|
||||
|
||||
[dependencies]
|
||||
console_error_panic_hook = "0.1"
|
||||
|
||||
@ -25,6 +25,10 @@ mod __macro {
|
||||
/// previously (represented by the tail) is still set after P has been set.
|
||||
/// - ^ the two impls would be overlapping, where it not for the `How` argument, which resolves
|
||||
/// the conflict.
|
||||
#[diagnostic::on_unimplemented(
|
||||
message = "property `{P}` is required but not provided",
|
||||
label = "missing required property `{P}`"
|
||||
)]
|
||||
pub trait HasProp<P, How> {}
|
||||
|
||||
/// A marker trait to ensure that the builder has received all required props.
|
||||
@ -32,6 +36,10 @@ mod __macro {
|
||||
/// all properties marked as required as a bound on the impl.
|
||||
///
|
||||
/// [`Properties`]: super::Properties
|
||||
#[diagnostic::on_unimplemented(
|
||||
message = "not all required properties have been provided for `{P}`",
|
||||
label = "missing required properties"
|
||||
)]
|
||||
pub trait HasAllProps<P, How> {}
|
||||
|
||||
/// Trait finishing the builder and verifying all props were set.
|
||||
@ -81,6 +89,10 @@ mod __macro {
|
||||
|
||||
/// Trait to specify the requirement for Self to be a valid token signaling all props have been
|
||||
/// provided to the builder.
|
||||
#[diagnostic::on_unimplemented(
|
||||
message = "not all required properties have been provided",
|
||||
label = "missing required properties for this component"
|
||||
)]
|
||||
pub trait AllPropsFor<Builder, How> {}
|
||||
|
||||
impl<Token, Builder: Buildable<Token>, How> AllPropsFor<Builder, How> for Token where
|
||||
|
||||
@ -50,10 +50,7 @@ fn main() -> ExitCode {
|
||||
}
|
||||
|
||||
if outdated_examples.is_empty() {
|
||||
println!(
|
||||
"All examples are up-to-date with the latest wasm_opt version: {}",
|
||||
latest_wasm_opt
|
||||
);
|
||||
println!("All examples are up-to-date with the latest wasm_opt version: {latest_wasm_opt}");
|
||||
return ExitCode::from(0);
|
||||
}
|
||||
|
||||
@ -62,16 +59,13 @@ fn main() -> ExitCode {
|
||||
outdated_examples.len()
|
||||
);
|
||||
for example in &outdated_examples {
|
||||
println!(" - {}", example);
|
||||
println!(" - {example}");
|
||||
}
|
||||
println!("Latest wasm_opt version is: {}", latest_wasm_opt);
|
||||
println!("Latest wasm_opt version is: {latest_wasm_opt}");
|
||||
println!("Updating all examples...");
|
||||
|
||||
let updated_count = update_all_examples(&outdated_example_paths, &latest_wasm_opt);
|
||||
println!(
|
||||
"Updated {} example configurations to use {}",
|
||||
updated_count, latest_wasm_opt
|
||||
);
|
||||
println!("Updated {updated_count} example configurations to use {latest_wasm_opt}");
|
||||
|
||||
ExitCode::from(0)
|
||||
}
|
||||
@ -90,8 +84,7 @@ pub fn update_all_examples(outdated_paths: &[PathBuf], latest_version: &str) ->
|
||||
re.replace(&content, |_: ®ex::Captures| {
|
||||
format!(
|
||||
r#"[tools]
|
||||
wasm_opt = "{}""#,
|
||||
latest_version
|
||||
wasm_opt = "{latest_version}""#
|
||||
)
|
||||
})
|
||||
.to_string()
|
||||
@ -100,8 +93,7 @@ wasm_opt = "{}""#,
|
||||
if content.is_empty() {
|
||||
format!(
|
||||
r#"[tools]
|
||||
wasm_opt = "{}""#,
|
||||
latest_version
|
||||
wasm_opt = "{latest_version}""#
|
||||
)
|
||||
} else {
|
||||
format!(
|
||||
|
||||
@ -32,10 +32,7 @@ pub fn get_latest_wasm_opt_version() -> String {
|
||||
.text()
|
||||
.unwrap_or_else(|_| "Could not read error response".to_string());
|
||||
|
||||
panic!(
|
||||
"GitHub API request failed with status: {}. Details: {}",
|
||||
status, error_text
|
||||
);
|
||||
panic!("GitHub API request failed with status: {status}. Details: {error_text}");
|
||||
}
|
||||
|
||||
let release: GitHubRelease = res.json().expect("Failed to parse GitHub API response");
|
||||
|
||||
@ -54,10 +54,10 @@ fn main() -> ExitCode {
|
||||
outdated_example_paths.push(path.clone());
|
||||
}
|
||||
|
||||
println!("::group::Building {}", example);
|
||||
println!("::group::Building {example}");
|
||||
|
||||
if !build_example(&path, &output_dir, &example) {
|
||||
eprintln!("::error ::{} failed to build", example);
|
||||
eprintln!("::error ::{example} failed to build");
|
||||
failure = true;
|
||||
}
|
||||
|
||||
@ -105,7 +105,7 @@ fn build_example(path: &Path, output_dir: &Path, example: &str) -> bool {
|
||||
.arg("--dist")
|
||||
.arg(&dist_dir)
|
||||
.arg("--public-url")
|
||||
.arg(format!("{}/{}", public_url_prefix, example))
|
||||
.arg(format!("{public_url_prefix}/{example}"))
|
||||
.arg("--no-sri")
|
||||
.status();
|
||||
|
||||
|
||||
@ -11,7 +11,7 @@ bundler for Rust.
|
||||
To install Rust, follow the [official instructions](https://www.rust-lang.org/tools/install).
|
||||
|
||||
:::important
|
||||
The minimum supported Rust version (MSRV) for Yew is `1.76.0`. Older versions will not compile.
|
||||
The minimum supported Rust version (MSRV) for Yew is `1.78.0`. Older versions will not compile.
|
||||
You can check your toolchain version using
|
||||
`rustup show` (under "active toolchain") or `rustc --version`. To update your
|
||||
toolchain, run `rustup update`.
|
||||
|
||||
@ -9,7 +9,7 @@ Yew アプリケーションをコンパイル、ビルド、パッケージ、
|
||||
Rust をインストールするには、[公式の手順](https://www.rust-lang.org/tools/install) に従ってください。
|
||||
|
||||
:::important
|
||||
Yew がサポートする最低 Rust バージョン(MSRV)は `1.76.0` です。古いバージョンではコンパイルできません。`rustup show`(「active toolchain」の下)または `rustc --version` を使用してツールチェーンのバージョンを確認できます。ツールチェーンを更新するには、`rustup update` を実行してください。
|
||||
Yew がサポートする最低 Rust バージョン(MSRV)は `1.78.0` です。古いバージョンではコンパイルできません。`rustup show`(「active toolchain」の下)または `rustc --version` を使用してツールチェーンのバージョンを確認できます。ツールチェーンを更新するには、`rustup update` を実行してください。
|
||||
:::
|
||||
|
||||
## WebAssembly ターゲットのインストール
|
||||
|
||||
@ -9,7 +9,7 @@ Yew アプリケーションをコンパイル、ビルド、パッケージ、
|
||||
Rust をインストールするには、[公式の手順](https://www.rust-lang.org/tools/install) に従ってください。
|
||||
|
||||
:::important
|
||||
Yew がサポートする最低 Rust バージョン(MSRV)は `1.76.0` です。古いバージョンではコンパイルできません。`rustup show`(「active toolchain」の下)または `rustc --version` を使用してツールチェーンのバージョンを確認できます。ツールチェーンを更新するには、`rustup update` を実行してください。
|
||||
Yew がサポートする最低 Rust バージョン(MSRV)は `1.78.0` です。古いバージョンではコンパイルできません。`rustup show`(「active toolchain」の下)または `rustc --version` を使用してツールチェーンのバージョンを確認できます。ツールチェーンを更新するには、`rustup update` を実行してください。
|
||||
:::
|
||||
|
||||
## WebAssembly ターゲットのインストール
|
||||
|
||||
@ -9,7 +9,7 @@ title: '开始使用'
|
||||
要安装 Rust,请按照[官方说明](https://www.rust-lang.org/tools/install)。
|
||||
|
||||
:::important
|
||||
Yew 支持的最低 Rust 版本(MSRV)是 `1.76.0`。旧版本将无法编译。您可以使用 `rustup show`(在“active toolchain”下)或 `rustc --version` 检查您的工具链版本。要更新您的工具链,请运行 `rustup update`。
|
||||
Yew 支持的最低 Rust 版本(MSRV)是 `1.78.0`。旧版本将无法编译。您可以使用 `rustup show`(在“active toolchain”下)或 `rustc --version` 检查您的工具链版本。要更新您的工具链,请运行 `rustup update`。
|
||||
:::
|
||||
|
||||
## 安装 WebAssembly 目标
|
||||
|
||||
@ -9,7 +9,7 @@ title: '开始使用'
|
||||
要安装 Rust,请按照[官方说明](https://www.rust-lang.org/tools/install)。
|
||||
|
||||
:::important
|
||||
Yew 支持的最低 Rust 版本(MSRV)是 `1.76.0`。旧版本将无法编译。您可以使用 `rustup show`(在“active toolchain”下)或 `rustc --version` 检查您的工具链版本。要更新您的工具链,请运行 `rustup update`。
|
||||
Yew 支持的最低 Rust 版本(MSRV)是 `1.78.0`。旧版本将无法编译。您可以使用 `rustup show`(在“active toolchain”下)或 `rustc --version` 检查您的工具链版本。要更新您的工具链,请运行 `rustup update`。
|
||||
:::
|
||||
|
||||
## 安装 WebAssembly 目标
|
||||
|
||||
@ -9,7 +9,7 @@ title: '開始使用'
|
||||
要安裝 Rust,請按照[官方說明](https://www.rust-lang.org/tools/install)。
|
||||
|
||||
:::important
|
||||
Yew 支援的最低 Rust 版本(MSRV)是 `1.76.0`。舊版將無法編譯。您可以使用 `rustup show`(在「active toolchain」下)或 `rustc --version` 檢查您的工具鏈版本。若要更新您的工具鏈,請執行 `rustup update`。
|
||||
Yew 支援的最低 Rust 版本(MSRV)是 `1.78.0`。舊版將無法編譯。您可以使用 `rustup show`(在「active toolchain」下)或 `rustc --version` 檢查您的工具鏈版本。若要更新您的工具鏈,請執行 `rustup update`。
|
||||
:::
|
||||
|
||||
## 安裝 WebAssembly 目標
|
||||
|
||||
@ -9,7 +9,7 @@ title: '開始使用'
|
||||
要安裝 Rust,請按照[官方說明](https://www.rust-lang.org/tools/install)。
|
||||
|
||||
:::important
|
||||
Yew 支援的最低 Rust 版本(MSRV)是 `1.76.0`。舊版將無法編譯。您可以使用 `rustup show`(在「active toolchain」下)或 `rustc --version` 檢查您的工具鏈版本。若要更新您的工具鏈,請執行 `rustup update`。
|
||||
Yew 支援的最低 Rust 版本(MSRV)是 `1.78.0`。舊版將無法編譯。您可以使用 `rustup show`(在「active toolchain」下)或 `rustc --version` 檢查您的工具鏈版本。若要更新您的工具鏈,請執行 `rustup update`。
|
||||
:::
|
||||
|
||||
## 安裝 WebAssembly 目標
|
||||
|
||||
@ -11,7 +11,7 @@ bundler for Rust.
|
||||
To install Rust, follow the [official instructions](https://www.rust-lang.org/tools/install).
|
||||
|
||||
:::important
|
||||
The minimum supported Rust version (MSRV) for Yew is `1.76.0`. Older versions will not compile.
|
||||
The minimum supported Rust version (MSRV) for Yew is `1.78.0`. Older versions will not compile.
|
||||
You can check your toolchain version using
|
||||
`rustup show` (under "active toolchain") or `rustc --version`. To update your
|
||||
toolchain, run `rustup update`.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user