From 41776f1084a10f446f16dab2a2b3a27b34827ce0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 13 Oct 2023 16:08:39 +0200 Subject: [PATCH 1/3] Update UI tests for 1.73.0 --- tests/max_encoded_len_ui.rs | 3 - tests/max_encoded_len_ui/crate_str.stderr | 56 +++++++++++-------- .../max_encoded_len_ui/incomplete_attr.stderr | 56 +++++++++++-------- .../missing_crate_specifier.stderr | 56 +++++++++++-------- tests/max_encoded_len_ui/not_encode.stderr | 47 ++++++++-------- tests/max_encoded_len_ui/not_mel.stderr | 48 +++++++++------- tests/max_encoded_len_ui/union.stderr | 28 +++++++++- .../unsupported_variant.stderr | 37 +++++++----- 8 files changed, 206 insertions(+), 125 deletions(-) diff --git a/tests/max_encoded_len_ui.rs b/tests/max_encoded_len_ui.rs index 2bf41457..c4c4cf4e 100644 --- a/tests/max_encoded_len_ui.rs +++ b/tests/max_encoded_len_ui.rs @@ -16,9 +16,6 @@ #[test] #[cfg(feature = "derive")] fn derive_no_bound_ui() { - // As trybuild is using `cargo check`, we don't need the real WASM binaries. - std::env::set_var("SKIP_WASM_BUILD", "1"); - let t = trybuild::TestCases::new(); t.compile_fail("tests/max_encoded_len_ui/*.rs"); t.pass("tests/max_encoded_len_ui/pass/*.rs"); diff --git a/tests/max_encoded_len_ui/crate_str.stderr b/tests/max_encoded_len_ui/crate_str.stderr index c9c46cb1..045f6813 100644 --- a/tests/max_encoded_len_ui/crate_str.stderr +++ b/tests/max_encoded_len_ui/crate_str.stderr @@ -4,25 +4,37 @@ error: Invalid attribute: only `#[codec(dumb_trait_bound)]`, `#[codec(crate = pa 4 | #[codec(crate = "parity_scale_codec")] | ^^^^^ -error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied - --> tests/max_encoded_len_ui/crate_str.rs:5:8 - | -5 | struct Example; - | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` - | - = help: the following other types implement trait `WrapperTypeEncode`: - &T - &mut T - Arc - Box - Cow<'a, T> - Rc - String - Vec - parity_scale_codec::Ref<'a, T, U> - = note: required for `Example` to implement `Encode` -note: required by a bound in `MaxEncodedLen` - --> src/max_encoded_len.rs - | - | pub trait MaxEncodedLen: Encode { - | ^^^^^^ required by this bound in `MaxEncodedLen` +error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` + --> tests/max_encoded_len_ui/crate_str.rs:1:34 + | +1 | use parity_scale_codec::{Encode, MaxEncodedLen}; + | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root + | +note: found an item that was configured out + --> src/lib.rs + | + | pub use max_encoded_len::MaxEncodedLen; + | ^^^^^^^^^^^^^ + = note: the item is gated behind the `max-encoded-len` feature +note: found an item that was configured out + --> src/lib.rs + | + | pub use parity_scale_codec_derive::MaxEncodedLen; + | ^^^^^^^^^^^^^ + +error: cannot determine resolution for the derive macro `MaxEncodedLen` + --> tests/max_encoded_len_ui/crate_str.rs:3:18 + | +3 | #[derive(Encode, MaxEncodedLen)] + | ^^^^^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error[E0599]: no function or associated item named `max_encoded_len` found for struct `Example` in the current scope + --> tests/max_encoded_len_ui/crate_str.rs:8:19 + | +5 | struct Example; + | -------------- function or associated item `max_encoded_len` not found for this struct +... +8 | let _ = Example::max_encoded_len(); + | ^^^^^^^^^^^^^^^ function or associated item not found in `Example` diff --git a/tests/max_encoded_len_ui/incomplete_attr.stderr b/tests/max_encoded_len_ui/incomplete_attr.stderr index b9c58104..f706e5bc 100644 --- a/tests/max_encoded_len_ui/incomplete_attr.stderr +++ b/tests/max_encoded_len_ui/incomplete_attr.stderr @@ -4,25 +4,37 @@ error: Invalid attribute: only `#[codec(dumb_trait_bound)]`, `#[codec(crate = pa 4 | #[codec(crate)] | ^^^^^ -error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied - --> tests/max_encoded_len_ui/incomplete_attr.rs:5:8 - | -5 | struct Example; - | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` - | - = help: the following other types implement trait `WrapperTypeEncode`: - &T - &mut T - Arc - Box - Cow<'a, T> - Rc - String - Vec - parity_scale_codec::Ref<'a, T, U> - = note: required for `Example` to implement `Encode` -note: required by a bound in `MaxEncodedLen` - --> src/max_encoded_len.rs - | - | pub trait MaxEncodedLen: Encode { - | ^^^^^^ required by this bound in `MaxEncodedLen` +error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` + --> tests/max_encoded_len_ui/incomplete_attr.rs:1:34 + | +1 | use parity_scale_codec::{Encode, MaxEncodedLen}; + | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root + | +note: found an item that was configured out + --> src/lib.rs + | + | pub use max_encoded_len::MaxEncodedLen; + | ^^^^^^^^^^^^^ + = note: the item is gated behind the `max-encoded-len` feature +note: found an item that was configured out + --> src/lib.rs + | + | pub use parity_scale_codec_derive::MaxEncodedLen; + | ^^^^^^^^^^^^^ + +error: cannot determine resolution for the derive macro `MaxEncodedLen` + --> tests/max_encoded_len_ui/incomplete_attr.rs:3:18 + | +3 | #[derive(Encode, MaxEncodedLen)] + | ^^^^^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error[E0599]: no function or associated item named `max_encoded_len` found for struct `Example` in the current scope + --> tests/max_encoded_len_ui/incomplete_attr.rs:8:19 + | +5 | struct Example; + | -------------- function or associated item `max_encoded_len` not found for this struct +... +8 | let _ = Example::max_encoded_len(); + | ^^^^^^^^^^^^^^^ function or associated item not found in `Example` diff --git a/tests/max_encoded_len_ui/missing_crate_specifier.stderr b/tests/max_encoded_len_ui/missing_crate_specifier.stderr index c056aec9..57d7faf1 100644 --- a/tests/max_encoded_len_ui/missing_crate_specifier.stderr +++ b/tests/max_encoded_len_ui/missing_crate_specifier.stderr @@ -4,25 +4,37 @@ error: Invalid attribute: only `#[codec(dumb_trait_bound)]`, `#[codec(crate = pa 4 | #[codec(parity_scale_codec)] | ^^^^^^^^^^^^^^^^^^ -error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied - --> tests/max_encoded_len_ui/missing_crate_specifier.rs:5:8 - | -5 | struct Example; - | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` - | - = help: the following other types implement trait `WrapperTypeEncode`: - &T - &mut T - Arc - Box - Cow<'a, T> - Rc - String - Vec - parity_scale_codec::Ref<'a, T, U> - = note: required for `Example` to implement `Encode` -note: required by a bound in `MaxEncodedLen` - --> src/max_encoded_len.rs - | - | pub trait MaxEncodedLen: Encode { - | ^^^^^^ required by this bound in `MaxEncodedLen` +error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` + --> tests/max_encoded_len_ui/missing_crate_specifier.rs:1:34 + | +1 | use parity_scale_codec::{Encode, MaxEncodedLen}; + | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root + | +note: found an item that was configured out + --> src/lib.rs + | + | pub use max_encoded_len::MaxEncodedLen; + | ^^^^^^^^^^^^^ + = note: the item is gated behind the `max-encoded-len` feature +note: found an item that was configured out + --> src/lib.rs + | + | pub use parity_scale_codec_derive::MaxEncodedLen; + | ^^^^^^^^^^^^^ + +error: cannot determine resolution for the derive macro `MaxEncodedLen` + --> tests/max_encoded_len_ui/missing_crate_specifier.rs:3:18 + | +3 | #[derive(Encode, MaxEncodedLen)] + | ^^^^^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error[E0599]: no function or associated item named `max_encoded_len` found for struct `Example` in the current scope + --> tests/max_encoded_len_ui/missing_crate_specifier.rs:8:19 + | +5 | struct Example; + | -------------- function or associated item `max_encoded_len` not found for this struct +... +8 | let _ = Example::max_encoded_len(); + | ^^^^^^^^^^^^^^^ function or associated item not found in `Example` diff --git a/tests/max_encoded_len_ui/not_encode.stderr b/tests/max_encoded_len_ui/not_encode.stderr index 3e4e57bc..cafa4467 100644 --- a/tests/max_encoded_len_ui/not_encode.stderr +++ b/tests/max_encoded_len_ui/not_encode.stderr @@ -1,22 +1,25 @@ -error[E0277]: the trait bound `NotEncode: WrapperTypeEncode` is not satisfied - --> tests/max_encoded_len_ui/not_encode.rs:4:8 - | -4 | struct NotEncode; - | ^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `NotEncode` - | - = help: the following other types implement trait `WrapperTypeEncode`: - &T - &mut T - Arc - Box - Cow<'a, T> - Rc - String - Vec - parity_scale_codec::Ref<'a, T, U> - = note: required for `NotEncode` to implement `Encode` -note: required by a bound in `MaxEncodedLen` - --> src/max_encoded_len.rs - | - | pub trait MaxEncodedLen: Encode { - | ^^^^^^ required by this bound in `MaxEncodedLen` +error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` + --> tests/max_encoded_len_ui/not_encode.rs:1:26 + | +1 | use parity_scale_codec::{MaxEncodedLen}; + | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root + | +note: found an item that was configured out + --> src/lib.rs + | + | pub use max_encoded_len::MaxEncodedLen; + | ^^^^^^^^^^^^^ + = note: the item is gated behind the `max-encoded-len` feature +note: found an item that was configured out + --> src/lib.rs + | + | pub use parity_scale_codec_derive::MaxEncodedLen; + | ^^^^^^^^^^^^^ + +error: cannot determine resolution for the derive macro `MaxEncodedLen` + --> tests/max_encoded_len_ui/not_encode.rs:3:10 + | +3 | #[derive(MaxEncodedLen)] + | ^^^^^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports diff --git a/tests/max_encoded_len_ui/not_mel.stderr b/tests/max_encoded_len_ui/not_mel.stderr index d0a0891c..1ec40d2b 100644 --- a/tests/max_encoded_len_ui/not_mel.stderr +++ b/tests/max_encoded_len_ui/not_mel.stderr @@ -1,24 +1,34 @@ -error[E0599]: the function or associated item `max_encoded_len` exists for struct `Generic`, but its trait bounds were not satisfied +error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` + --> tests/max_encoded_len_ui/not_mel.rs:1:34 + | +1 | use parity_scale_codec::{Encode, MaxEncodedLen}; + | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root + | +note: found an item that was configured out + --> src/lib.rs + | + | pub use max_encoded_len::MaxEncodedLen; + | ^^^^^^^^^^^^^ + = note: the item is gated behind the `max-encoded-len` feature +note: found an item that was configured out + --> src/lib.rs + | + | pub use parity_scale_codec_derive::MaxEncodedLen; + | ^^^^^^^^^^^^^ + +error: cannot determine resolution for the derive macro `MaxEncodedLen` + --> tests/max_encoded_len_ui/not_mel.rs:6:18 + | +6 | #[derive(Encode, MaxEncodedLen)] + | ^^^^^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports + +error[E0599]: no function or associated item named `max_encoded_len` found for struct `Generic` in the current scope --> tests/max_encoded_len_ui/not_mel.rs:12:29 | -4 | struct NotMel; - | ------------- doesn't satisfy `NotMel: MaxEncodedLen` -... 7 | struct Generic { - | ----------------- - | | - | function or associated item `max_encoded_len` not found for this struct - | doesn't satisfy `Generic: MaxEncodedLen` + | ----------------- function or associated item `max_encoded_len` not found for this struct ... 12 | let _ = Generic::::max_encoded_len(); - | ^^^^^^^^^^^^^^^ function or associated item cannot be called on `Generic` due to unsatisfied trait bounds - | - = note: trait bound `NotMel: MaxEncodedLen` was not satisfied -note: the trait `MaxEncodedLen` must be implemented - --> src/max_encoded_len.rs - | - | pub trait MaxEncodedLen: Encode { - | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ - = help: items from traits can only be used if the trait is implemented and in scope - = note: the following trait defines an item `max_encoded_len`, perhaps you need to implement it: - candidate #1: `MaxEncodedLen` + | ^^^^^^^^^^^^^^^ function or associated item not found in `Generic` diff --git a/tests/max_encoded_len_ui/union.stderr b/tests/max_encoded_len_ui/union.stderr index af3dc931..3b955016 100644 --- a/tests/max_encoded_len_ui/union.stderr +++ b/tests/max_encoded_len_ui/union.stderr @@ -1,5 +1,31 @@ error: Union types are not supported. - --> $DIR/union.rs:4:1 + --> tests/max_encoded_len_ui/union.rs:4:1 | 4 | union Union { | ^^^^^ + +error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` + --> tests/max_encoded_len_ui/union.rs:1:34 + | +1 | use parity_scale_codec::{Encode, MaxEncodedLen}; + | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root + | +note: found an item that was configured out + --> src/lib.rs + | + | pub use max_encoded_len::MaxEncodedLen; + | ^^^^^^^^^^^^^ + = note: the item is gated behind the `max-encoded-len` feature +note: found an item that was configured out + --> src/lib.rs + | + | pub use parity_scale_codec_derive::MaxEncodedLen; + | ^^^^^^^^^^^^^ + +error: cannot determine resolution for the derive macro `MaxEncodedLen` + --> tests/max_encoded_len_ui/union.rs:3:18 + | +3 | #[derive(Encode, MaxEncodedLen)] + | ^^^^^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports diff --git a/tests/max_encoded_len_ui/unsupported_variant.stderr b/tests/max_encoded_len_ui/unsupported_variant.stderr index c4a48c60..5b58504c 100644 --- a/tests/max_encoded_len_ui/unsupported_variant.stderr +++ b/tests/max_encoded_len_ui/unsupported_variant.stderr @@ -1,16 +1,25 @@ -error[E0277]: the trait bound `NotMel: MaxEncodedLen` is not satisfied - --> tests/max_encoded_len_ui/unsupported_variant.rs:8:9 +error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` + --> tests/max_encoded_len_ui/unsupported_variant.rs:1:34 | -8 | NotMel(NotMel), - | ^^^^^^ the trait `MaxEncodedLen` is not implemented for `NotMel` +1 | use parity_scale_codec::{Encode, MaxEncodedLen}; + | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root | - = help: the following other types implement trait `MaxEncodedLen`: - () - (TupleElement0, TupleElement1) - (TupleElement0, TupleElement1, TupleElement2) - (TupleElement0, TupleElement1, TupleElement2, TupleElement3) - (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4) - (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5) - (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6) - (TupleElement0, TupleElement1, TupleElement2, TupleElement3, TupleElement4, TupleElement5, TupleElement6, TupleElement7) - and $N others +note: found an item that was configured out + --> src/lib.rs + | + | pub use max_encoded_len::MaxEncodedLen; + | ^^^^^^^^^^^^^ + = note: the item is gated behind the `max-encoded-len` feature +note: found an item that was configured out + --> src/lib.rs + | + | pub use parity_scale_codec_derive::MaxEncodedLen; + | ^^^^^^^^^^^^^ + +error: cannot determine resolution for the derive macro `MaxEncodedLen` + --> tests/max_encoded_len_ui/unsupported_variant.rs:6:18 + | +6 | #[derive(Encode, MaxEncodedLen)] + | ^^^^^^^^^^^^^ + | + = note: import resolution is stuck, try simplifying macro imports From e37ffd782fb2ca92dac072e91dad4a2589c215e8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 13 Oct 2023 16:12:07 +0200 Subject: [PATCH 2/3] CLIPPY --- derive/src/trait_bounds.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/derive/src/trait_bounds.rs b/derive/src/trait_bounds.rs index 6b044efe..f803990d 100644 --- a/derive/src/trait_bounds.rs +++ b/derive/src/trait_bounds.rs @@ -128,9 +128,8 @@ pub fn add( let ty_params = generics .type_params() - .filter_map(|tp| { - skip_type_params.iter().all(|skip| skip != &tp.ident).then(|| tp.ident.clone()) - }) + .filter(|tp| skip_type_params.iter().all(|skip| skip != &tp.ident)) + .map(|tp| tp.ident.clone()) .collect::>(); if ty_params.is_empty() { return Ok(()) From 17ae9a9fecd7cebb9046a32085cac39c0c59c440 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bastian=20K=C3=B6cher?= Date: Fri, 13 Oct 2023 16:19:38 +0200 Subject: [PATCH 3/3] Also update MEL uis --- tests/max_encoded_len_ui/crate_str.stderr | 52 +++++++------------ .../max_encoded_len_ui/incomplete_attr.stderr | 52 +++++++------------ .../missing_crate_specifier.stderr | 52 +++++++------------ tests/max_encoded_len_ui/not_encode.stderr | 41 +++++++-------- tests/max_encoded_len_ui/not_mel.stderr | 48 +++++++---------- tests/max_encoded_len_ui/union.stderr | 26 ---------- .../unsupported_variant.stderr | 37 +++++-------- 7 files changed, 112 insertions(+), 196 deletions(-) diff --git a/tests/max_encoded_len_ui/crate_str.stderr b/tests/max_encoded_len_ui/crate_str.stderr index 045f6813..23a451f6 100644 --- a/tests/max_encoded_len_ui/crate_str.stderr +++ b/tests/max_encoded_len_ui/crate_str.stderr @@ -4,37 +4,25 @@ error: Invalid attribute: only `#[codec(dumb_trait_bound)]`, `#[codec(crate = pa 4 | #[codec(crate = "parity_scale_codec")] | ^^^^^ -error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` - --> tests/max_encoded_len_ui/crate_str.rs:1:34 - | -1 | use parity_scale_codec::{Encode, MaxEncodedLen}; - | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root - | -note: found an item that was configured out - --> src/lib.rs - | - | pub use max_encoded_len::MaxEncodedLen; - | ^^^^^^^^^^^^^ - = note: the item is gated behind the `max-encoded-len` feature -note: found an item that was configured out - --> src/lib.rs - | - | pub use parity_scale_codec_derive::MaxEncodedLen; - | ^^^^^^^^^^^^^ - -error: cannot determine resolution for the derive macro `MaxEncodedLen` - --> tests/max_encoded_len_ui/crate_str.rs:3:18 - | -3 | #[derive(Encode, MaxEncodedLen)] - | ^^^^^^^^^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports - -error[E0599]: no function or associated item named `max_encoded_len` found for struct `Example` in the current scope - --> tests/max_encoded_len_ui/crate_str.rs:8:19 +error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied + --> tests/max_encoded_len_ui/crate_str.rs:5:8 | 5 | struct Example; - | -------------- function or associated item `max_encoded_len` not found for this struct -... -8 | let _ = Example::max_encoded_len(); - | ^^^^^^^^^^^^^^^ function or associated item not found in `Example` + | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` + | + = help: the following other types implement trait `WrapperTypeEncode`: + Box + Cow<'a, T> + parity_scale_codec::Ref<'a, T, U> + Rc + Arc + Vec + String + &T + &mut T + = note: required for `Example` to implement `Encode` +note: required by a bound in `MaxEncodedLen` + --> src/max_encoded_len.rs + | + | pub trait MaxEncodedLen: Encode { + | ^^^^^^ required by this bound in `MaxEncodedLen` diff --git a/tests/max_encoded_len_ui/incomplete_attr.stderr b/tests/max_encoded_len_ui/incomplete_attr.stderr index f706e5bc..b5ab07c7 100644 --- a/tests/max_encoded_len_ui/incomplete_attr.stderr +++ b/tests/max_encoded_len_ui/incomplete_attr.stderr @@ -4,37 +4,25 @@ error: Invalid attribute: only `#[codec(dumb_trait_bound)]`, `#[codec(crate = pa 4 | #[codec(crate)] | ^^^^^ -error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` - --> tests/max_encoded_len_ui/incomplete_attr.rs:1:34 - | -1 | use parity_scale_codec::{Encode, MaxEncodedLen}; - | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root - | -note: found an item that was configured out - --> src/lib.rs - | - | pub use max_encoded_len::MaxEncodedLen; - | ^^^^^^^^^^^^^ - = note: the item is gated behind the `max-encoded-len` feature -note: found an item that was configured out - --> src/lib.rs - | - | pub use parity_scale_codec_derive::MaxEncodedLen; - | ^^^^^^^^^^^^^ - -error: cannot determine resolution for the derive macro `MaxEncodedLen` - --> tests/max_encoded_len_ui/incomplete_attr.rs:3:18 - | -3 | #[derive(Encode, MaxEncodedLen)] - | ^^^^^^^^^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports - -error[E0599]: no function or associated item named `max_encoded_len` found for struct `Example` in the current scope - --> tests/max_encoded_len_ui/incomplete_attr.rs:8:19 +error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied + --> tests/max_encoded_len_ui/incomplete_attr.rs:5:8 | 5 | struct Example; - | -------------- function or associated item `max_encoded_len` not found for this struct -... -8 | let _ = Example::max_encoded_len(); - | ^^^^^^^^^^^^^^^ function or associated item not found in `Example` + | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` + | + = help: the following other types implement trait `WrapperTypeEncode`: + Box + Cow<'a, T> + parity_scale_codec::Ref<'a, T, U> + Rc + Arc + Vec + String + &T + &mut T + = note: required for `Example` to implement `Encode` +note: required by a bound in `MaxEncodedLen` + --> src/max_encoded_len.rs + | + | pub trait MaxEncodedLen: Encode { + | ^^^^^^ required by this bound in `MaxEncodedLen` diff --git a/tests/max_encoded_len_ui/missing_crate_specifier.stderr b/tests/max_encoded_len_ui/missing_crate_specifier.stderr index 57d7faf1..68e98a6a 100644 --- a/tests/max_encoded_len_ui/missing_crate_specifier.stderr +++ b/tests/max_encoded_len_ui/missing_crate_specifier.stderr @@ -4,37 +4,25 @@ error: Invalid attribute: only `#[codec(dumb_trait_bound)]`, `#[codec(crate = pa 4 | #[codec(parity_scale_codec)] | ^^^^^^^^^^^^^^^^^^ -error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` - --> tests/max_encoded_len_ui/missing_crate_specifier.rs:1:34 - | -1 | use parity_scale_codec::{Encode, MaxEncodedLen}; - | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root - | -note: found an item that was configured out - --> src/lib.rs - | - | pub use max_encoded_len::MaxEncodedLen; - | ^^^^^^^^^^^^^ - = note: the item is gated behind the `max-encoded-len` feature -note: found an item that was configured out - --> src/lib.rs - | - | pub use parity_scale_codec_derive::MaxEncodedLen; - | ^^^^^^^^^^^^^ - -error: cannot determine resolution for the derive macro `MaxEncodedLen` - --> tests/max_encoded_len_ui/missing_crate_specifier.rs:3:18 - | -3 | #[derive(Encode, MaxEncodedLen)] - | ^^^^^^^^^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports - -error[E0599]: no function or associated item named `max_encoded_len` found for struct `Example` in the current scope - --> tests/max_encoded_len_ui/missing_crate_specifier.rs:8:19 +error[E0277]: the trait bound `Example: WrapperTypeEncode` is not satisfied + --> tests/max_encoded_len_ui/missing_crate_specifier.rs:5:8 | 5 | struct Example; - | -------------- function or associated item `max_encoded_len` not found for this struct -... -8 | let _ = Example::max_encoded_len(); - | ^^^^^^^^^^^^^^^ function or associated item not found in `Example` + | ^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `Example` + | + = help: the following other types implement trait `WrapperTypeEncode`: + Box + Cow<'a, T> + parity_scale_codec::Ref<'a, T, U> + Rc + Arc + Vec + String + &T + &mut T + = note: required for `Example` to implement `Encode` +note: required by a bound in `MaxEncodedLen` + --> src/max_encoded_len.rs + | + | pub trait MaxEncodedLen: Encode { + | ^^^^^^ required by this bound in `MaxEncodedLen` diff --git a/tests/max_encoded_len_ui/not_encode.stderr b/tests/max_encoded_len_ui/not_encode.stderr index cafa4467..b2fb1d85 100644 --- a/tests/max_encoded_len_ui/not_encode.stderr +++ b/tests/max_encoded_len_ui/not_encode.stderr @@ -1,25 +1,22 @@ -error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` - --> tests/max_encoded_len_ui/not_encode.rs:1:26 +error[E0277]: the trait bound `NotEncode: WrapperTypeEncode` is not satisfied + --> tests/max_encoded_len_ui/not_encode.rs:4:8 | -1 | use parity_scale_codec::{MaxEncodedLen}; - | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root +4 | struct NotEncode; + | ^^^^^^^^^ the trait `WrapperTypeEncode` is not implemented for `NotEncode` | -note: found an item that was configured out - --> src/lib.rs + = help: the following other types implement trait `WrapperTypeEncode`: + Box + Cow<'a, T> + parity_scale_codec::Ref<'a, T, U> + Rc + Arc + Vec + String + &T + &mut T + = note: required for `NotEncode` to implement `Encode` +note: required by a bound in `MaxEncodedLen` + --> src/max_encoded_len.rs | - | pub use max_encoded_len::MaxEncodedLen; - | ^^^^^^^^^^^^^ - = note: the item is gated behind the `max-encoded-len` feature -note: found an item that was configured out - --> src/lib.rs - | - | pub use parity_scale_codec_derive::MaxEncodedLen; - | ^^^^^^^^^^^^^ - -error: cannot determine resolution for the derive macro `MaxEncodedLen` - --> tests/max_encoded_len_ui/not_encode.rs:3:10 - | -3 | #[derive(MaxEncodedLen)] - | ^^^^^^^^^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports + | pub trait MaxEncodedLen: Encode { + | ^^^^^^ required by this bound in `MaxEncodedLen` diff --git a/tests/max_encoded_len_ui/not_mel.stderr b/tests/max_encoded_len_ui/not_mel.stderr index 1ec40d2b..d0a0891c 100644 --- a/tests/max_encoded_len_ui/not_mel.stderr +++ b/tests/max_encoded_len_ui/not_mel.stderr @@ -1,34 +1,24 @@ -error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` - --> tests/max_encoded_len_ui/not_mel.rs:1:34 - | -1 | use parity_scale_codec::{Encode, MaxEncodedLen}; - | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root - | -note: found an item that was configured out - --> src/lib.rs - | - | pub use max_encoded_len::MaxEncodedLen; - | ^^^^^^^^^^^^^ - = note: the item is gated behind the `max-encoded-len` feature -note: found an item that was configured out - --> src/lib.rs - | - | pub use parity_scale_codec_derive::MaxEncodedLen; - | ^^^^^^^^^^^^^ - -error: cannot determine resolution for the derive macro `MaxEncodedLen` - --> tests/max_encoded_len_ui/not_mel.rs:6:18 - | -6 | #[derive(Encode, MaxEncodedLen)] - | ^^^^^^^^^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports - -error[E0599]: no function or associated item named `max_encoded_len` found for struct `Generic` in the current scope +error[E0599]: the function or associated item `max_encoded_len` exists for struct `Generic`, but its trait bounds were not satisfied --> tests/max_encoded_len_ui/not_mel.rs:12:29 | +4 | struct NotMel; + | ------------- doesn't satisfy `NotMel: MaxEncodedLen` +... 7 | struct Generic { - | ----------------- function or associated item `max_encoded_len` not found for this struct + | ----------------- + | | + | function or associated item `max_encoded_len` not found for this struct + | doesn't satisfy `Generic: MaxEncodedLen` ... 12 | let _ = Generic::::max_encoded_len(); - | ^^^^^^^^^^^^^^^ function or associated item not found in `Generic` + | ^^^^^^^^^^^^^^^ function or associated item cannot be called on `Generic` due to unsatisfied trait bounds + | + = note: trait bound `NotMel: MaxEncodedLen` was not satisfied +note: the trait `MaxEncodedLen` must be implemented + --> src/max_encoded_len.rs + | + | pub trait MaxEncodedLen: Encode { + | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + = help: items from traits can only be used if the trait is implemented and in scope + = note: the following trait defines an item `max_encoded_len`, perhaps you need to implement it: + candidate #1: `MaxEncodedLen` diff --git a/tests/max_encoded_len_ui/union.stderr b/tests/max_encoded_len_ui/union.stderr index 3b955016..fa21ec9c 100644 --- a/tests/max_encoded_len_ui/union.stderr +++ b/tests/max_encoded_len_ui/union.stderr @@ -3,29 +3,3 @@ error: Union types are not supported. | 4 | union Union { | ^^^^^ - -error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` - --> tests/max_encoded_len_ui/union.rs:1:34 - | -1 | use parity_scale_codec::{Encode, MaxEncodedLen}; - | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root - | -note: found an item that was configured out - --> src/lib.rs - | - | pub use max_encoded_len::MaxEncodedLen; - | ^^^^^^^^^^^^^ - = note: the item is gated behind the `max-encoded-len` feature -note: found an item that was configured out - --> src/lib.rs - | - | pub use parity_scale_codec_derive::MaxEncodedLen; - | ^^^^^^^^^^^^^ - -error: cannot determine resolution for the derive macro `MaxEncodedLen` - --> tests/max_encoded_len_ui/union.rs:3:18 - | -3 | #[derive(Encode, MaxEncodedLen)] - | ^^^^^^^^^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports diff --git a/tests/max_encoded_len_ui/unsupported_variant.stderr b/tests/max_encoded_len_ui/unsupported_variant.stderr index 5b58504c..848139a1 100644 --- a/tests/max_encoded_len_ui/unsupported_variant.stderr +++ b/tests/max_encoded_len_ui/unsupported_variant.stderr @@ -1,25 +1,16 @@ -error[E0432]: unresolved import `parity_scale_codec::MaxEncodedLen` - --> tests/max_encoded_len_ui/unsupported_variant.rs:1:34 +error[E0277]: the trait bound `NotMel: MaxEncodedLen` is not satisfied + --> tests/max_encoded_len_ui/unsupported_variant.rs:8:9 | -1 | use parity_scale_codec::{Encode, MaxEncodedLen}; - | ^^^^^^^^^^^^^ no `MaxEncodedLen` in the root +8 | NotMel(NotMel), + | ^^^^^^ the trait `MaxEncodedLen` is not implemented for `NotMel` | -note: found an item that was configured out - --> src/lib.rs - | - | pub use max_encoded_len::MaxEncodedLen; - | ^^^^^^^^^^^^^ - = note: the item is gated behind the `max-encoded-len` feature -note: found an item that was configured out - --> src/lib.rs - | - | pub use parity_scale_codec_derive::MaxEncodedLen; - | ^^^^^^^^^^^^^ - -error: cannot determine resolution for the derive macro `MaxEncodedLen` - --> tests/max_encoded_len_ui/unsupported_variant.rs:6:18 - | -6 | #[derive(Encode, MaxEncodedLen)] - | ^^^^^^^^^^^^^ - | - = note: import resolution is stuck, try simplifying macro imports + = help: the following other types implement trait `MaxEncodedLen`: + bool + i8 + i16 + i32 + i64 + i128 + u8 + u16 + and $N others