@@ -12,7 +12,7 @@ use syn::spanned::Spanned;
1212use syn:: token:: Mut ;
1313use syn:: {
1414 Block , Expr , FnArg , GenericParam , ItemFn , Lifetime , Pat , PatType , ReturnType , Signature , Token ,
15- Type , TypeParamBound , Visibility ,
15+ Type , TypeParamBound , Visibility , WhereClause ,
1616} ;
1717
1818use crate :: { CompileError , HashMap , HashSet , parse_ts_or_compile_error} ;
@@ -130,6 +130,8 @@ struct FilterSignature {
130130 args_optional : Vec < FilterArgumentOptional > ,
131131 /// Generic parameters in use by the required filter arguments
132132 args_required_generics : HashMap < Ident , FilterArgumentGeneric > ,
133+ /// The `where` clause of the source function
134+ where_clause : Option < WhereClause > ,
133135 /// Filter function result type
134136 result_ty : ReturnType ,
135137}
@@ -272,6 +274,7 @@ impl FilterSignature {
272274 args_required,
273275 args_optional,
274276 args_required_generics,
277+ where_clause : sig. generics . where_clause . clone ( ) ,
275278 result_ty : sig. output . clone ( ) ,
276279 } )
277280 }
@@ -677,6 +680,7 @@ impl FilterSignature {
677680 } ) ;
678681
679682 let fn_token = & sig. fn_token ;
683+ let where_clause = self . where_clause . as_ref ( ) ;
680684 let impl_generics = quote ! { #( #required_generics: #required_generic_bounds, ) * } ;
681685 let impl_struct_generics = quote ! { #( #required_generics, ) * #( #required_flags, ) * } ;
682686 let lifetimes_fillers = self . lifetimes_fillers ( |l| l. used_by_extra_args ) ;
@@ -690,7 +694,7 @@ impl FilterSignature {
690694 self ,
691695 #input_mutability #input_ident: #input_ty,
692696 #env_ident: #env_ty
693- ) #result_ty {
697+ ) #result_ty #where_clause {
694698 // map filter variables with original name into scope
695699 #( #required_args ) *
696700 #( #optional_args ) *
0 commit comments