Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
fix some failing ui tests (#9157)
Browse files Browse the repository at this point in the history
* fix some failing ui tests

* Update frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr

* Update frame/support/test/tests/pallet_ui/call_argument_invalid_bound_2.stderr

* fix ui test

* fix ui test

* TRYBUILD=overwrite cargo test --workspace -- ui

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
Co-authored-by: thiolliere <gui.thiolliere@gmail.com>
  • Loading branch information
3 people authored Jun 21, 2021
1 parent d6c33e7 commit abbe24e
Show file tree
Hide file tree
Showing 9 changed files with 121 additions and 75 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Config>::Bar`
error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
--> $DIR/call_argument_invalid_bound.rs:20:41
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^
|
help: consider further restricting this bound
| ^ `<T as pallet::Config>::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
17 | #[pallet::call + std::cmp::PartialEq]
| ^^^^^^^^^^^^^^^^^^^^^
= help: the trait `std::fmt::Debug` is not implemented for `<T as pallet::Config>::Bar`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&<T as pallet::Config>::Bar`
= note: required for the cast to the object type `dyn std::fmt::Debug`

error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfied
--> $DIR/call_argument_invalid_bound.rs:20:41
Expand All @@ -17,12 +16,13 @@ error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfi
|
= note: required by `clone`

error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Config>::Bar`
--> $DIR/call_argument_invalid_bound.rs:20:41
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^ `<T as pallet::Config>::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
| ^
|
= help: the trait `std::fmt::Debug` is not implemented for `<T as pallet::Config>::Bar`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&<T as pallet::Config>::Bar`
= note: required for the cast to the object type `dyn std::fmt::Debug`
help: consider further restricting this bound
|
17 | #[pallet::call + std::cmp::PartialEq]
| ^^^^^^^^^^^^^^^^^^^^^
Original file line number Diff line number Diff line change
@@ -1,39 +1,12 @@
error[E0277]: the trait bound `<T as pallet::Config>::Bar: WrapperTypeDecode` is not satisfied
--> $DIR/call_argument_invalid_bound_2.rs:20:41
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^ the trait `WrapperTypeDecode` is not implemented for `<T as pallet::Config>::Bar`
|
::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:277:18
|
277 | fn decode<I: Input>(input: &mut I) -> Result<Self, Error>;
| ----- required by this bound in `pallet::_::_parity_scale_codec::Decode::decode`
|
= note: required because of the requirements on the impl of `Decode` for `<T as pallet::Config>::Bar`

error[E0277]: the trait bound `<T as pallet::Config>::Bar: WrapperTypeEncode` is not satisfied
--> $DIR/call_argument_invalid_bound_2.rs:20:41
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^ the trait `WrapperTypeEncode` is not implemented for `<T as pallet::Config>::Bar`
|
::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:216:21
|
216 | fn encode_to<T: Output + ?Sized>(&self, dest: &mut T) {
| ------ required by this bound in `encode_to`
|
= note: required because of the requirements on the impl of `pallet::_::_parity_scale_codec::Encode` for `<T as pallet::Config>::Bar`

error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Config>::Bar`
error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
--> $DIR/call_argument_invalid_bound_2.rs:20:41
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^
|
help: consider further restricting this bound
| ^ `<T as pallet::Config>::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
17 | #[pallet::call + std::cmp::PartialEq]
| ^^^^^^^^^^^^^^^^^^^^^
= help: the trait `std::fmt::Debug` is not implemented for `<T as pallet::Config>::Bar`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&<T as pallet::Config>::Bar`
= note: required for the cast to the object type `dyn std::fmt::Debug`

error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfied
--> $DIR/call_argument_invalid_bound_2.rs:20:41
Expand All @@ -43,12 +16,39 @@ error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfi
|
= note: required by `clone`

error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Config>::Bar`
--> $DIR/call_argument_invalid_bound_2.rs:20:41
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^ `<T as pallet::Config>::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
| ^
|
= help: the trait `std::fmt::Debug` is not implemented for `<T as pallet::Config>::Bar`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&<T as pallet::Config>::Bar`
= note: required for the cast to the object type `dyn std::fmt::Debug`
help: consider further restricting this bound
|
17 | #[pallet::call + std::cmp::PartialEq]
| ^^^^^^^^^^^^^^^^^^^^^

error[E0277]: the trait bound `<T as pallet::Config>::Bar: WrapperTypeEncode` is not satisfied
--> $DIR/call_argument_invalid_bound_2.rs:20:41
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^ the trait `WrapperTypeEncode` is not implemented for `<T as pallet::Config>::Bar`
|
::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:216:21
|
216 | fn encode_to<T: Output + ?Sized>(&self, dest: &mut T) {
| ------ required by this bound in `encode_to`
|
= note: required because of the requirements on the impl of `pallet::_::_parity_scale_codec::Encode` for `<T as pallet::Config>::Bar`

error[E0277]: the trait bound `<T as pallet::Config>::Bar: WrapperTypeDecode` is not satisfied
--> $DIR/call_argument_invalid_bound_2.rs:20:41
|
20 | pub fn foo(origin: OriginFor<T>, bar: T::Bar) -> DispatchResultWithPostInfo {
| ^ the trait `WrapperTypeDecode` is not implemented for `<T as pallet::Config>::Bar`
|
::: /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/parity-scale-codec-2.1.1/src/codec.rs:277:18
|
277 | fn decode<I: Input>(input: &mut I) -> Result<Self, Error>;
| ----- required by this bound in `pallet::_::_parity_scale_codec::Decode::decode`
|
= note: required because of the requirements on the impl of `Decode` for `<T as pallet::Config>::Bar`
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
error[E0369]: binary operation `==` cannot be applied to type `&Bar`
error[E0277]: `Bar` doesn't implement `std::fmt::Debug`
--> $DIR/call_argument_invalid_bound_3.rs:22:41
|
22 | pub fn foo(origin: OriginFor<T>, bar: Bar) -> DispatchResultWithPostInfo {
| ^^^
| ^^^ `Bar` cannot be formatted using `{:?}`
|
= note: an implementation of `std::cmp::PartialEq` might be missing for `&Bar`
= help: the trait `std::fmt::Debug` is not implemented for `Bar`
= note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&Bar`
= note: required for the cast to the object type `dyn std::fmt::Debug`

error[E0277]: the trait bound `Bar: Clone` is not satisfied
--> $DIR/call_argument_invalid_bound_3.rs:22:41
Expand All @@ -14,13 +17,10 @@ error[E0277]: the trait bound `Bar: Clone` is not satisfied
|
= note: required by `clone`

error[E0277]: `Bar` doesn't implement `std::fmt::Debug`
error[E0369]: binary operation `==` cannot be applied to type `&Bar`
--> $DIR/call_argument_invalid_bound_3.rs:22:41
|
22 | pub fn foo(origin: OriginFor<T>, bar: Bar) -> DispatchResultWithPostInfo {
| ^^^ `Bar` cannot be formatted using `{:?}`
| ^^^
|
= help: the trait `std::fmt::Debug` is not implemented for `Bar`
= note: add `#[derive(Debug)]` or manually implement `std::fmt::Debug`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&Bar`
= note: required for the cast to the object type `dyn std::fmt::Debug`
= note: an implementation of `std::cmp::PartialEq` might be missing for `&Bar`
16 changes: 8 additions & 8 deletions frame/support/test/tests/pallet_ui/event_field_not_member.stderr
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfied
--> $DIR/event_field_not_member.rs:23:7
|
23 | B { b: T::Bar },
| ^ `<T as pallet::Config>::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
| ^ the trait `Clone` is not implemented for `<T as pallet::Config>::Bar`
|
= help: the trait `std::fmt::Debug` is not implemented for `<T as pallet::Config>::Bar`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&<T as pallet::Config>::Bar`
= note: required for the cast to the object type `dyn std::fmt::Debug`
= note: required by `clone`

error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Config>::Bar`
--> $DIR/event_field_not_member.rs:23:7
Expand All @@ -19,10 +17,12 @@ help: consider further restricting this bound
22 | pub enum Event<T: Config + std::cmp::PartialEq> {
| ^^^^^^^^^^^^^^^^^^^^^

error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfied
error[E0277]: `<T as pallet::Config>::Bar` doesn't implement `std::fmt::Debug`
--> $DIR/event_field_not_member.rs:23:7
|
23 | B { b: T::Bar },
| ^ the trait `Clone` is not implemented for `<T as pallet::Config>::Bar`
| ^ `<T as pallet::Config>::Bar` cannot be formatted using `{:?}` because it doesn't implement `std::fmt::Debug`
|
= note: required by `clone`
= help: the trait `std::fmt::Debug` is not implemented for `<T as pallet::Config>::Bar`
= note: required because of the requirements on the impl of `std::fmt::Debug` for `&<T as pallet::Config>::Bar`
= note: required for the cast to the object type `dyn std::fmt::Debug`
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ error[E0277]: the trait bound `Bar: MaxEncodedLen` is not satisfied
10 | #[pallet::generate_storage_info]
| ^^^^^^^^^^^^^^^^^^^^^ the trait `MaxEncodedLen` is not implemented for `Bar`
|
= note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `NMapKey<frame_support::Twox64Concat, Bar>`
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo<T>, NMapKey<frame_support::Twox64Concat, Bar>, u32>`
= note: required because of the requirements on the impl of `KeyGeneratorMaxEncodedLen` for `Key<frame_support::Twox64Concat, Bar>`
= note: required because of the requirements on the impl of `StorageInfoTrait` for `frame_support::pallet_prelude::StorageNMap<_GeneratedPrefixForStorageFoo<T>, Key<frame_support::Twox64Concat, Bar>, u32>`
= note: required by `storage_info`
4 changes: 2 additions & 2 deletions max-encoded-len/tests/max_encoded_len_ui/union.stderr
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
error: Union types are not supported
error: Union types are not supported.
--> $DIR/union.rs:5:1
|
5 | union Union {
| ^^^^^

error: Union types are not supported.
error: Union types are not supported
--> $DIR/union.rs:5:1
|
5 | union Union {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ error[E0053]: method `test` has an incompatible type for trait
| --- type in trait
...
19 | fn test(data: String) {}
| ^^^^^^ expected `u64`, found struct `std::string::String`
| ^^^^^^
| |
| expected `u64`, found struct `std::string::String`
| help: change the parameter type to match the trait: `u64`
|
= note: expected fn pointer `fn(u64)`
found fn pointer `fn(std::string::String)`
Expand All @@ -21,7 +24,17 @@ error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for tr
| |_- type in trait
16 |
17 | sp_api::impl_runtime_apis! {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found struct `std::string::String`
| -^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| _expected `u64`, found struct `std::string::String`
| |
18 | | impl self::Api<Block> for Runtime {
19 | | fn test(data: String) {}
20 | | }
... |
32 | | }
33 | | }
| |_- help: change the parameter type to match the trait: `std::option::Option<u64>`
|
= note: expected fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &BlockId<__SR_API_BLOCK__>, ExecutionContext, std::option::Option<u64>, Vec<_>) -> Result<_, _>`
found fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &BlockId<__SR_API_BLOCK__>, ExecutionContext, std::option::Option<std::string::String>, Vec<_>) -> Result<_, _>`
Expand Down
24 changes: 22 additions & 2 deletions primitives/api/test/tests/ui/mock_only_self_reference.stderr
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,17 @@ error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for tr
| |_- type in trait
...
12 | sp_api::mock_impl_runtime_apis! {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `()`
| -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| _expected `u64`, found `()`
| |
13 | | impl Api<Block> for MockApi {
14 | | fn test(self, data: u64) {}
15 | |
16 | | fn test2(&mut self, data: u64) {}
17 | | }
18 | | }
| |_- help: change the parameter type to match the trait: `Option<u64>`
|
= note: expected fn pointer `fn(&MockApi, &BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, Extrinsic>>, ExecutionContext, Option<u64>, Vec<_>) -> Result<_, _>`
found fn pointer `fn(&MockApi, &BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, Extrinsic>>, ExecutionContext, Option<()>, Vec<_>) -> Result<_, _>`
Expand All @@ -40,7 +50,17 @@ error[E0053]: method `Api_test2_runtime_api_impl` has an incompatible type for t
| |_- type in trait
...
12 | sp_api::mock_impl_runtime_apis! {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `()`
| -^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| _expected `u64`, found `()`
| |
13 | | impl Api<Block> for MockApi {
14 | | fn test(self, data: u64) {}
15 | |
16 | | fn test2(&mut self, data: u64) {}
17 | | }
18 | | }
| |_- help: change the parameter type to match the trait: `Option<u64>`
|
= note: expected fn pointer `fn(&MockApi, &BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, Extrinsic>>, ExecutionContext, Option<u64>, Vec<_>) -> Result<_, _>`
found fn pointer `fn(&MockApi, &BlockId<sp_runtime::generic::block::Block<sp_runtime::generic::header::Header<u64, sp_runtime::traits::BlakeTwo256>, Extrinsic>>, ExecutionContext, Option<()>, Vec<_>) -> Result<_, _>`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ error[E0053]: method `test` has an incompatible type for trait
| --- type in trait
...
19 | fn test(data: &u64) {
| ^^^^ expected `u64`, found `&u64`
| ^^^^
| |
| expected `u64`, found `&u64`
| help: change the parameter type to match the trait: `u64`
|
= note: expected fn pointer `fn(u64)`
found fn pointer `fn(&u64)`
Expand All @@ -21,7 +24,17 @@ error[E0053]: method `Api_test_runtime_api_impl` has an incompatible type for tr
| |_- type in trait
16 |
17 | sp_api::impl_runtime_apis! {
| ^^^^^^^^^^^^^^^^^^^^^^^^^^ expected `u64`, found `&u64`
| -^^^^^^^^^^^^^^^^^^^^^^^^^
| |
| _expected `u64`, found `&u64`
| |
18 | | impl self::Api<Block> for Runtime {
19 | | fn test(data: &u64) {
20 | | unimplemented!()
... |
34 | | }
35 | | }
| |_- help: change the parameter type to match the trait: `std::option::Option<u64>`
|
= note: expected fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &BlockId<__SR_API_BLOCK__>, ExecutionContext, std::option::Option<u64>, Vec<_>) -> Result<_, _>`
found fn pointer `fn(&RuntimeApiImpl<__SR_API_BLOCK__, RuntimeApiImplCall>, &BlockId<__SR_API_BLOCK__>, ExecutionContext, std::option::Option<&u64>, Vec<_>) -> Result<_, _>`
Expand Down

0 comments on commit abbe24e

Please sign in to comment.