@@ -15,13 +15,12 @@ use rustc_span::hygiene::MacroKind;
15
15
use rustc_span:: symbol:: { kw, sym, Symbol } ;
16
16
17
17
use 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 ,
19
20
} ;
20
21
use crate :: core:: DocContext ;
21
22
use crate :: formats:: item_type:: ItemType ;
22
23
23
- use super :: { Clean , Visibility } ;
24
-
25
24
type Attrs < ' hir > = rustc_middle:: ty:: Attributes < ' hir > ;
26
25
27
26
/// Attempt to inline a definition into this AST.
@@ -208,7 +207,7 @@ crate fn build_external_trait(cx: &mut DocContext<'_>, did: DefId) -> clean::Tra
208
207
. collect ( ) ;
209
208
210
209
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) ;
212
211
let generics = filter_non_trait_generics ( did, generics) ;
213
212
let ( generics, supertrait_bounds) = separate_supertrait_bounds ( generics) ;
214
213
let is_auto = cx. tcx . trait_is_auto ( did) ;
@@ -230,7 +229,9 @@ fn build_external_function(cx: &mut DocContext<'_>, did: DefId) -> clean::Functi
230
229
let predicates = cx. tcx . predicates_of ( did) ;
231
230
let ( generics, decl) = clean:: enter_impl_trait ( cx, |cx| {
232
231
// 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)
234
235
} ) ;
235
236
clean:: Function {
236
237
decl,
@@ -243,7 +244,7 @@ fn build_enum(cx: &mut DocContext<'_>, did: DefId) -> clean::Enum {
243
244
let predicates = cx. tcx . explicit_predicates_of ( did) ;
244
245
245
246
clean:: Enum {
246
- generics : ( cx. tcx . generics_of ( did) , predicates) . clean ( cx ) ,
247
+ generics : clean_ty_generics ( cx, cx . tcx . generics_of ( did) , predicates) ,
247
248
variants_stripped : false ,
248
249
variants : cx. tcx . adt_def ( did) . variants . iter ( ) . map ( |v| v. clean ( cx) ) . collect ( ) ,
249
250
}
@@ -255,7 +256,7 @@ fn build_struct(cx: &mut DocContext<'_>, did: DefId) -> clean::Struct {
255
256
256
257
clean:: Struct {
257
258
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) ,
259
260
fields : variant. fields . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ,
260
261
fields_stripped : false ,
261
262
}
@@ -265,7 +266,7 @@ fn build_union(cx: &mut DocContext<'_>, did: DefId) -> clean::Union {
265
266
let predicates = cx. tcx . explicit_predicates_of ( did) ;
266
267
let variant = cx. tcx . adt_def ( did) . non_enum_variant ( ) ;
267
268
268
- let generics = ( cx. tcx . generics_of ( did) , predicates) . clean ( cx ) ;
269
+ let generics = clean_ty_generics ( cx, cx . tcx . generics_of ( did) , predicates) ;
269
270
let fields = variant. fields . iter ( ) . map ( |x| x. clean ( cx) ) . collect ( ) ;
270
271
clean:: Union { generics, fields, fields_stripped : false }
271
272
}
@@ -276,7 +277,7 @@ fn build_type_alias(cx: &mut DocContext<'_>, did: DefId) -> clean::Typedef {
276
277
277
278
clean:: Typedef {
278
279
type_,
279
- generics : ( cx. tcx . generics_of ( did) , predicates) . clean ( cx ) ,
280
+ generics : clean_ty_generics ( cx, cx . tcx . generics_of ( did) , predicates) ,
280
281
item_type : None ,
281
282
}
282
283
}
@@ -440,7 +441,9 @@ crate fn build_impl(
440
441
}
441
442
} )
442
443
. 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
+ } ) ,
444
447
) ,
445
448
} ;
446
449
let polarity = tcx. impl_polarity ( did) ;
0 commit comments