@@ -109,7 +109,10 @@ impl Clean<GenericBound> for hir::GenericBound<'_> {
109
109
} ;
110
110
111
111
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
+ } ,
113
116
hir:: TraitBoundModifier :: None ,
114
117
)
115
118
}
@@ -761,8 +764,13 @@ fn clean_fn_or_proc_macro(
761
764
762
765
impl < ' a > Clean < Function > for ( & ' a hir:: FnSig < ' a > , & ' a hir:: Generics < ' a > , hir:: BodyId ) {
763
766
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
+ } ) ;
766
774
Function { decl, generics, header : self . 0 . header }
767
775
}
768
776
}
@@ -804,17 +812,12 @@ impl<'a> Clean<Arguments> for (&'a [hir::Ty<'a>], hir::BodyId) {
804
812
}
805
813
}
806
814
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 }
818
821
}
819
822
820
823
impl < ' tcx > Clean < FnDecl > for ( DefId , ty:: PolyFnSig < ' tcx > ) {
@@ -894,7 +897,11 @@ impl Clean<Item> for hir::TraitItem<'_> {
894
897
}
895
898
hir:: TraitItemKind :: Fn ( ref sig, hir:: TraitFn :: Required ( names) ) => {
896
899
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)
898
905
} ) ;
899
906
let mut t = Function { header : sig. header , decl, generics } ;
900
907
if t. header . constness == hir:: Constness :: Const
@@ -1727,8 +1734,10 @@ impl Clean<PathSegment> for hir::PathSegment<'_> {
1727
1734
impl Clean < BareFunctionDecl > for hir:: BareFnTy < ' _ > {
1728
1735
fn clean ( & self , cx : & mut DocContext < ' _ > ) -> BareFunctionDecl {
1729
1736
let ( generic_params, decl) = enter_impl_trait ( cx, |cx| {
1737
+ // NOTE: generics must be cleaned before args
1730
1738
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) ;
1732
1741
( generic_params, decl)
1733
1742
} ) ;
1734
1743
BareFunctionDecl { unsafety : self . unsafety , abi : self . abi , decl, generic_params }
@@ -2029,8 +2038,13 @@ impl Clean<Item> for (&hir::ForeignItem<'_>, Option<Symbol>) {
2029
2038
let kind = match item. kind {
2030
2039
hir:: ForeignItemKind :: Fn ( decl, names, ref generics) => {
2031
2040
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
+ } ) ;
2034
2048
ForeignFunctionItem ( Function {
2035
2049
decl,
2036
2050
generics,
0 commit comments