mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 09:57:56 +00:00
sp-api: Set correct where bound in the generated code (#14252)
The where bound for the `create_metadata` function wasn't correct. This pr fixes this by using the where bound declared at the type declaration augmented with the manual where bound.
This commit is contained in:
@@ -162,15 +162,18 @@ pub fn generate_decl_runtime_metadata(decl: &ItemTrait) -> TokenStream2 {
|
||||
ty.default = None;
|
||||
}
|
||||
|
||||
let where_clause = where_clause
|
||||
.iter()
|
||||
.map(|ty| quote!(#ty: #crate_::scale_info::TypeInfo + 'static));
|
||||
where_clause
|
||||
.into_iter()
|
||||
.map(|ty| parse_quote!(#ty: #crate_::scale_info::TypeInfo + 'static))
|
||||
.for_each(|w| generics.make_where_clause().predicates.push(w));
|
||||
|
||||
let (impl_generics, _, where_clause) = generics.split_for_impl();
|
||||
|
||||
quote!(
|
||||
#( #attrs )*
|
||||
#[inline(always)]
|
||||
pub fn runtime_metadata #generics () -> #crate_::metadata_ir::RuntimeApiMetadataIR
|
||||
where #( #where_clause, )*
|
||||
pub fn runtime_metadata #impl_generics () -> #crate_::metadata_ir::RuntimeApiMetadataIR
|
||||
#where_clause
|
||||
{
|
||||
#crate_::metadata_ir::RuntimeApiMetadataIR {
|
||||
name: #trait_name,
|
||||
|
||||
Reference in New Issue
Block a user