@@ -15,13 +15,12 @@ use rustc_span::hygiene::MacroKind;
1515use rustc_span:: symbol:: { kw, sym, Symbol } ;
1616
1717use crate :: clean:: {
18- self , utils, Attributes , AttributesExt , ImplKind , ItemId , NestedAttributesExt , Type ,
18+ self , clean_ty_generics, utils, Attributes , AttributesExt , Clean , ImplKind , ItemId ,
19+ NestedAttributesExt , Type , Visibility ,
1920} ;
2021use crate :: core:: DocContext ;
2122use crate :: formats:: item_type:: ItemType ;
2223
23- use super :: { Clean , Visibility } ;
24-
2524type Attrs < ' hir > = rustc_middle:: ty:: Attributes < ' hir > ;
2625
2726/// Attempt to inline a definition into this AST.
@@ -208,7 +207,7 @@ crate fn build_external_trait(cx: &mut DocContext<'_>, did: DefId) -> clean::Tra
208207 . collect ( ) ;
209208
210209 let predicates = cx. tcx . predicates_of ( did) ;
211- let generics = ( cx. tcx . generics_of ( did) , predicates) . clean ( cx ) ;
210+ let generics = clean_ty_generics ( cx, cx . tcx . generics_of ( did) , predicates) ;
212211 let generics = filter_non_trait_generics ( did, generics) ;
213212 let ( generics, supertrait_bounds) = separate_supertrait_bounds ( generics) ;
214213 let is_auto = cx. tcx . trait_is_auto ( did) ;
@@ -230,7 +229,9 @@ fn build_external_function(cx: &mut DocContext<'_>, did: DefId) -> clean::Functi
230229 let predicates = cx. tcx . predicates_of ( did) ;
231230 let ( generics, decl) = clean:: enter_impl_trait ( cx, |cx| {
232231 // NOTE: generics need to be cleaned before the decl!
233- ( ( cx. tcx . generics_of ( did) , predicates) . clean ( cx) , ( did, sig) . clean ( cx) )
232+ let generics = clean_ty_generics ( cx, cx. tcx . generics_of ( did) , predicates) ;
233+ let decl = ( did, sig) . clean ( cx) ;
234+ ( generics, decl)
234235 } ) ;
235236 clean:: Function {
236237 decl,
@@ -243,7 +244,7 @@ fn build_enum(cx: &mut DocContext<'_>, did: DefId) -> clean::Enum {
243244 let predicates = cx. tcx . explicit_predicates_of ( did) ;
244245
245246 clean:: Enum {
246- generics : ( cx. tcx . generics_of ( did) , predicates) . clean ( cx ) ,
247+ generics : clean_ty_generics ( cx, cx . tcx . generics_of ( did) , predicates) ,
247248 variants_stripped : false ,
248249 variants : cx. tcx . adt_def ( did) . variants . iter ( ) . map ( |v| v. clean ( cx) ) . collect ( ) ,
249250 }
@@ -255,7 +256,7 @@ fn build_struct(cx: &mut DocContext<'_>, did: DefId) -> clean::Struct {
255256
256257 clean:: Struct {
257258 struct_type : variant. ctor_kind ,
258- generics : ( cx. tcx . generics_of ( did) , predicates) . clean ( cx ) ,
259+ generics : clean_ty_generics ( cx, cx . tcx . generics_of ( did) , predicates) ,
259260 fields : variant. fields . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
260261 fields_stripped : false ,
261262 }
@@ -265,7 +266,7 @@ fn build_union(cx: &mut DocContext<'_>, did: DefId) -> clean::Union {
265266 let predicates = cx. tcx . explicit_predicates_of ( did) ;
266267 let variant = cx. tcx . adt_def ( did) . non_enum_variant ( ) ;
267268
268- let generics = ( cx. tcx . generics_of ( did) , predicates) . clean ( cx ) ;
269+ let generics = clean_ty_generics ( cx, cx . tcx . generics_of ( did) , predicates) ;
269270 let fields = variant. fields . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ;
270271 clean:: Union { generics, fields, fields_stripped : false }
271272}
@@ -276,7 +277,7 @@ fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> clean::Typedef {
276277
277278 clean:: Typedef {
278279 type_,
279- generics : ( cx. tcx . generics_of ( did) , predicates) . clean ( cx ) ,
280+ generics : clean_ty_generics ( cx, cx . tcx . generics_of ( did) , predicates) ,
280281 item_type : None ,
281282 }
282283}
@@ -440,7 +441,9 @@ crate fn build_impl(
440441 }
441442 } )
442443 . collect :: < Vec < _ > > ( ) ,
443- clean:: enter_impl_trait ( cx, |cx| ( tcx. generics_of ( did) , predicates) . clean ( cx) ) ,
444+ clean:: enter_impl_trait ( cx, |cx| {
445+ clean_ty_generics ( cx, tcx. generics_of ( did) , predicates)
446+ } ) ,
444447 ) ,
445448 } ;
446449 let polarity = tcx. impl_polarity ( did) ;
0 commit comments