@@ -109,7 +109,10 @@ impl Clean<GenericBound> for hir::GenericBound<'_> {
109109 } ;
110110
111111 GenericBound :: TraitBound (
112- PolyTrait { trait_ : ( trait_ref, & * bindings) . clean ( cx) , generic_params : vec ! [ ] } ,
112+ PolyTrait {
113+ trait_ : ( trait_ref, & bindings[ ..] ) . clean ( cx) ,
114+ generic_params : vec ! [ ] ,
115+ } ,
113116 hir:: TraitBoundModifier :: None ,
114117 )
115118 }
@@ -761,8 +764,13 @@ fn clean_fn_or_proc_macro(
761764
762765impl < ' a > Clean < Function > for ( & ' a hir:: FnSig < ' a > , & ' a hir:: Generics < ' a > , hir:: BodyId ) {
763766 fn clean ( & self , cx : & mut DocContext < ' _ > ) -> Function {
764- let ( generics, decl) =
765- enter_impl_trait ( cx, |cx| ( self . 1 . clean ( cx) , ( & * self . 0 . decl , self . 2 ) . clean ( cx) ) ) ;
767+ let ( generics, decl) = enter_impl_trait ( cx, |cx| {
768+ // NOTE: generics must be cleaned before args
769+ let generics = self . 1 . clean ( cx) ;
770+ let args = ( self . 0 . decl . inputs , self . 2 ) . clean ( cx) ;
771+ let decl = clean_fn_decl_with_args ( cx, self . 0 . decl , args) ;
772+ ( generics, decl)
773+ } ) ;
766774 Function { decl, generics, header : self . 0 . header }
767775 }
768776}
@@ -804,17 +812,12 @@ impl<'a> Clean<Arguments> for (&'a [hir::Ty<'a>], hir::BodyId) {
804812 }
805813}
806814
807- impl < ' a , A : Copy > Clean < FnDecl > for ( & ' a hir:: FnDecl < ' a > , A )
808- where
809- ( & ' a [ hir:: Ty < ' a > ] , A ) : Clean < Arguments > ,
810- {
811- fn clean ( & self , cx : & mut DocContext < ' _ > ) -> FnDecl {
812- FnDecl {
813- inputs : ( self . 0 . inputs , self . 1 ) . clean ( cx) ,
814- output : self . 0 . output . clean ( cx) ,
815- c_variadic : self . 0 . c_variadic ,
816- }
817- }
815+ fn clean_fn_decl_with_args (
816+ cx : & mut DocContext < ' _ > ,
817+ decl : & hir:: FnDecl < ' _ > ,
818+ args : Arguments ,
819+ ) -> FnDecl {
820+ FnDecl { inputs : args, output : decl. output . clean ( cx) , c_variadic : decl. c_variadic }
818821}
819822
820823impl < ' tcx > Clean < FnDecl > for ( DefId , ty:: PolyFnSig < ' tcx > ) {
@@ -894,7 +897,11 @@ impl Clean<Item> for hir::TraitItem<'_> {
894897 }
895898 hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( names) ) => {
896899 let ( generics, decl) = enter_impl_trait ( cx, |cx| {
897- ( self . generics . clean ( cx) , ( sig. decl , names) . clean ( cx) )
900+ // NOTE: generics must be cleaned before args
901+ let generics = self . generics . clean ( cx) ;
902+ let args = ( sig. decl . inputs , names) . clean ( cx) ;
903+ let decl = clean_fn_decl_with_args ( cx, sig. decl , args) ;
904+ ( generics, decl)
898905 } ) ;
899906 let mut t = Function { header : sig. header , decl, generics } ;
900907 if t. header . constness == hir:: Constness :: Const
@@ -1727,8 +1734,10 @@ impl Clean<PathSegment> for hir::PathSegment<'_> {
17271734impl Clean < BareFunctionDecl > for hir:: BareFnTy < ' _ > {
17281735 fn clean ( & self , cx : & mut DocContext < ' _ > ) -> BareFunctionDecl {
17291736 let ( generic_params, decl) = enter_impl_trait ( cx, |cx| {
1737+ // NOTE: generics must be cleaned before args
17301738 let generic_params = self . generic_params . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ;
1731- let decl = ( self . decl , self . param_names ) . clean ( cx) ;
1739+ let args = ( self . decl . inputs , self . param_names ) . clean ( cx) ;
1740+ let decl = clean_fn_decl_with_args ( cx, self . decl , args) ;
17321741 ( generic_params, decl)
17331742 } ) ;
17341743 BareFunctionDecl { unsafety : self . unsafety , abi : self . abi , decl, generic_params }
@@ -2029,8 +2038,13 @@ impl Clean<Item> for (&hir::ForeignItem<'_>, Option<Symbol>) {
20292038 let kind = match item. kind {
20302039 hir:: ForeignItemKind :: Fn ( decl, names, ref generics) => {
20312040 let abi = cx. tcx . hir ( ) . get_foreign_abi ( item. hir_id ( ) ) ;
2032- let ( generics, decl) =
2033- enter_impl_trait ( cx, |cx| ( generics. clean ( cx) , ( decl, names) . clean ( cx) ) ) ;
2041+ let ( generics, decl) = enter_impl_trait ( cx, |cx| {
2042+ // NOTE: generics must be cleaned before args
2043+ let generics = generics. clean ( cx) ;
2044+ let args = ( decl. inputs , names) . clean ( cx) ;
2045+ let decl = clean_fn_decl_with_args ( cx, decl, args) ;
2046+ ( generics, decl)
2047+ } ) ;
20342048 ForeignFunctionItem ( Function {
20352049 decl,
20362050 generics,
0 commit comments