File tree 2 files changed +23
-4
lines changed
2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -1237,6 +1237,7 @@ pub struct TyParam {
1237
1237
pub did : DefId ,
1238
1238
pub bounds : Vec < TyParamBound > ,
1239
1239
pub default : Option < Type > ,
1240
+ pub synthetic : Option < hir:: SyntheticTyParamKind > ,
1240
1241
}
1241
1242
1242
1243
impl Clean < TyParam > for hir:: TyParam {
@@ -1246,6 +1247,7 @@ impl Clean<TyParam> for hir::TyParam {
1246
1247
did : cx. tcx . hir . local_def_id ( self . id ) ,
1247
1248
bounds : self . bounds . clean ( cx) ,
1248
1249
default : self . default . clean ( cx) ,
1250
+ synthetic : self . synthetic ,
1249
1251
}
1250
1252
}
1251
1253
}
@@ -1261,7 +1263,8 @@ impl<'tcx> Clean<TyParam> for ty::TypeParameterDef {
1261
1263
Some ( cx. tcx . type_of ( self . def_id ) . clean ( cx) )
1262
1264
} else {
1263
1265
None
1264
- }
1266
+ } ,
1267
+ synthetic : None ,
1265
1268
}
1266
1269
}
1267
1270
}
@@ -1629,6 +1632,16 @@ pub enum GenericParam {
1629
1632
Type ( TyParam ) ,
1630
1633
}
1631
1634
1635
+ impl GenericParam {
1636
+ pub fn is_synthetic_type_param ( & self ) -> bool {
1637
+ if let GenericParam :: Type ( ref t) = * self {
1638
+ t. synthetic . is_some ( )
1639
+ } else {
1640
+ false
1641
+ }
1642
+ }
1643
+ }
1644
+
1632
1645
impl Clean < GenericParam > for hir:: GenericParam {
1633
1646
fn clean ( & self , cx : & DocContext ) -> GenericParam {
1634
1647
match * self {
Original file line number Diff line number Diff line change @@ -148,11 +148,17 @@ impl fmt::Display for clean::GenericParam {
148
148
149
149
impl fmt:: Display for clean:: Generics {
150
150
fn fmt ( & self , f : & mut fmt:: Formatter ) -> fmt:: Result {
151
- if self . params . is_empty ( ) { return Ok ( ( ) ) }
151
+ let real_params = self . params
152
+ . iter ( )
153
+ . filter ( |p| !p. is_synthetic_type_param ( ) )
154
+ . collect :: < Vec < _ > > ( ) ;
155
+ if real_params. is_empty ( ) {
156
+ return Ok ( ( ) ) ;
157
+ }
152
158
if f. alternate ( ) {
153
- write ! ( f, "<{:#}>" , CommaSep ( & self . params ) )
159
+ write ! ( f, "<{:#}>" , CommaSep ( & real_params ) )
154
160
} else {
155
- write ! ( f, "<{}>" , CommaSep ( & self . params ) )
161
+ write ! ( f, "<{}>" , CommaSep ( & real_params ) )
156
162
}
157
163
}
158
164
}
You can’t perform that action at this time.
0 commit comments