Improve spans of pallet macro (#7830)

* fix spans

* convert name to snake case
This commit is contained in:
Guillaume Thiolliere
2021-01-06 10:16:05 +01:00
committed by GitHub
parent d2ac8bd941
commit 66a9093fa3
27 changed files with 303 additions and 144 deletions
@@ -6,8 +6,8 @@ error[E0369]: binary operation `==` cannot be applied to type `&<T as pallet::Co
|
help: consider further restricting this bound
|
1 | #[frame_support::pallet] + std::cmp::PartialEq
| ^^^^^^^^^^^^^^^^^^^^^
17 | #[pallet::call + std::cmp::PartialEq]
| ^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `<T as pallet::Config>::Bar: Clone` is not satisfied
--> $DIR/call_argument_invalid_bound.rs:20:37
@@ -4,5 +4,5 @@ error[E0446]: private type `_GeneratedPrefixForStorageFoo<T>` in public interfac
11 | #[pallet::generate_store(pub trait Store)]
| ^^^^^ can't leak private type
...
21 | type Foo<T> = StorageValue<_, u8>;
| - `_GeneratedPrefixForStorageFoo<T>` declared as private
20 | #[pallet::storage]
| - `_GeneratedPrefixForStorageFoo<T>` declared as private
@@ -0,0 +1,28 @@
#[frame_support::pallet]
mod pallet {
use frame_support::pallet_prelude::{Hooks, PhantomData};
use frame_system::pallet_prelude::BlockNumberFor;
#[pallet::config]
pub trait Config: frame_system::Config
where <Self as frame_system::Config>::AccountId: From<u32>
{}
#[pallet::pallet]
pub struct Pallet<T>(PhantomData<T>);
#[pallet::hooks]
impl<T: Config> Hooks<BlockNumberFor<T>> for Pallet<T>
where <T as frame_system::Config>::AccountId: From<u32>
{}
#[pallet::call]
impl<T: Config> Pallet<T>
where <T as frame_system::Config>::AccountId: From<u32>
{}
#[pallet::type_value] fn Foo<T: Config>() -> u32 { 3u32 }
}
fn main() {
}
@@ -0,0 +1,47 @@
error[E0277]: the trait bound `<T as frame_system::Config>::AccountId: From<u32>` is not satisfied
--> $DIR/type_value_forgotten_where_clause.rs:24:34
|
7 | pub trait Config: frame_system::Config
| ------ required by a bound in this
8 | where <Self as frame_system::Config>::AccountId: From<u32>
| --------- required by this bound in `pallet::Config`
...
24 | #[pallet::type_value] fn Foo<T: Config>() -> u32 { 3u32 }
| ^^^^^^ the trait `From<u32>` is not implemented for `<T as frame_system::Config>::AccountId`
|
help: consider further restricting the associated type
|
24 | #[pallet::type_value] fn Foo<T: Config>() -> u32 where <T as frame_system::Config>::AccountId: From<u32> { 3u32 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `<T as frame_system::Config>::AccountId: From<u32>` is not satisfied
--> $DIR/type_value_forgotten_where_clause.rs:24:12
|
7 | pub trait Config: frame_system::Config
| ------ required by a bound in this
8 | where <Self as frame_system::Config>::AccountId: From<u32>
| --------- required by this bound in `pallet::Config`
...
24 | #[pallet::type_value] fn Foo<T: Config>() -> u32 { 3u32 }
| ^^^^^^^^^^ the trait `From<u32>` is not implemented for `<T as frame_system::Config>::AccountId`
|
help: consider further restricting the associated type
|
24 | #[pallet::type_value where <T as frame_system::Config>::AccountId: From<u32>] fn Foo<T: Config>() -> u32 { 3u32 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
error[E0277]: the trait bound `<T as frame_system::Config>::AccountId: From<u32>` is not satisfied
--> $DIR/type_value_forgotten_where_clause.rs:24:12
|
7 | pub trait Config: frame_system::Config
| ------ required by a bound in this
8 | where <Self as frame_system::Config>::AccountId: From<u32>
| --------- required by this bound in `pallet::Config`
...
24 | #[pallet::type_value] fn Foo<T: Config>() -> u32 { 3u32 }
| ^^^^^^^^^^ the trait `From<u32>` is not implemented for `<T as frame_system::Config>::AccountId`
|
help: consider further restricting the associated type
|
24 | #[pallet::type_value] fn Foo<T: Config>() -> u32 where <T as frame_system::Config>::AccountId: From<u32> { 3u32 }
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^