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

Commit 1ba7fa7

Browse files
kianenigmaAnk4n
authored andcommitted
hooks default impl missing where clause (#13264)
* hooks default impl missing where clause * add tests * Update frame/support/test/tests/pallet_ui/pass/where_clause_missing_hooks.rs --------- Co-authored-by: parity-processbot <>
1 parent e35b92d commit 1ba7fa7

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

frame/support/procedural/src/pallet/expand/hooks.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub fn expand_hooks(def: &mut Def) -> proc_macro2::TokenStream {
7676
quote::quote! {
7777
impl<#type_impl_gen>
7878
#frame_support::traits::Hooks<<T as #frame_system::Config>::BlockNumber>
79-
for Pallet<#type_use_gen> {}
79+
for #pallet_ident<#type_use_gen> #where_clause {}
8080
}
8181
} else {
8282
proc_macro2::TokenStream::new()

frame/support/test/tests/pallet_ui/duplicate_store_attr.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,4 @@ mod pallet {
2222
type Foo<T> = StorageValue<_, u8>;
2323
}
2424

25-
fn main() {
26-
}
25+
fn main() {}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#[frame_support::pallet]
2+
mod pallet {
3+
#[pallet::config]
4+
pub trait Config: frame_system::Config where <Self as frame_system::Config>::Index: From<u128> {}
5+
6+
#[pallet::pallet]
7+
pub struct Pallet<T>(core::marker::PhantomData<T>);
8+
9+
#[pallet::call]
10+
impl<T: Config> Pallet<T> where <T as frame_system::Config>::Index: From<u128> {}
11+
12+
impl<T: Config> Pallet<T> where <T as frame_system::Config>::Index: From<u128> {
13+
fn foo(x: u128) {
14+
let _index = <T as frame_system::Config>::Index::from(x);
15+
}
16+
}
17+
}
18+
19+
fn main() {}

0 commit comments

Comments
 (0)