@@ -1270,7 +1270,10 @@ impl Clean<Option<Lifetime>> for ty::RegionKind {
1270
1270
ty:: RePlaceholder ( ..) |
1271
1271
ty:: ReEmpty |
1272
1272
ty:: ReClosureBound ( _) |
1273
- ty:: ReErased => None
1273
+ ty:: ReErased => {
1274
+ debug ! ( "Cannot clean region {:?}" , self ) ;
1275
+ None
1276
+ }
1274
1277
}
1275
1278
}
1276
1279
}
@@ -1309,16 +1312,16 @@ impl Clean<WherePredicate> for hir::WherePredicate {
1309
1312
}
1310
1313
}
1311
1314
1312
- impl < ' a > Clean < WherePredicate > for ty:: Predicate < ' a > {
1313
- fn clean ( & self , cx : & DocContext ) -> WherePredicate {
1315
+ impl < ' a > Clean < Option < WherePredicate > > for ty:: Predicate < ' a > {
1316
+ fn clean ( & self , cx : & DocContext ) -> Option < WherePredicate > {
1314
1317
use rustc:: ty:: Predicate ;
1315
1318
1316
1319
match * self {
1317
- Predicate :: Trait ( ref pred) => pred. clean ( cx) ,
1318
- Predicate :: Subtype ( ref pred) => pred. clean ( cx) ,
1320
+ Predicate :: Trait ( ref pred) => Some ( pred. clean ( cx) ) ,
1321
+ Predicate :: Subtype ( ref pred) => Some ( pred. clean ( cx) ) ,
1319
1322
Predicate :: RegionOutlives ( ref pred) => pred. clean ( cx) ,
1320
1323
Predicate :: TypeOutlives ( ref pred) => pred. clean ( cx) ,
1321
- Predicate :: Projection ( ref pred) => pred. clean ( cx) ,
1324
+ Predicate :: Projection ( ref pred) => Some ( pred. clean ( cx) ) ,
1322
1325
1323
1326
Predicate :: WellFormed ( ..) |
1324
1327
Predicate :: ObjectSafe ( ..) |
@@ -1344,24 +1347,39 @@ impl<'tcx> Clean<WherePredicate> for ty::SubtypePredicate<'tcx> {
1344
1347
}
1345
1348
}
1346
1349
1347
- impl < ' tcx > Clean < WherePredicate > for ty:: OutlivesPredicate < ty:: Region < ' tcx > , ty:: Region < ' tcx > > {
1348
- fn clean ( & self , cx : & DocContext ) -> WherePredicate {
1350
+ impl < ' tcx > Clean < Option < WherePredicate > > for
1351
+ ty:: OutlivesPredicate < ty:: Region < ' tcx > , ty:: Region < ' tcx > > {
1352
+
1353
+ fn clean ( & self , cx : & DocContext ) -> Option < WherePredicate > {
1349
1354
let ty:: OutlivesPredicate ( ref a, ref b) = * self ;
1350
- WherePredicate :: RegionPredicate {
1355
+
1356
+ match ( a, b) {
1357
+ ( ty:: ReEmpty , ty:: ReEmpty ) => {
1358
+ return None ;
1359
+ } ,
1360
+ _ => { }
1361
+ }
1362
+
1363
+ Some ( WherePredicate :: RegionPredicate {
1351
1364
lifetime : a. clean ( cx) . expect ( "failed to clean lifetime" ) ,
1352
1365
bounds : vec ! [ GenericBound :: Outlives ( b. clean( cx) . expect( "failed to clean bounds" ) ) ]
1353
- }
1366
+ } )
1354
1367
}
1355
1368
}
1356
1369
1357
- impl < ' tcx > Clean < WherePredicate > for ty:: OutlivesPredicate < Ty < ' tcx > , ty:: Region < ' tcx > > {
1358
- fn clean ( & self , cx : & DocContext ) -> WherePredicate {
1370
+ impl < ' tcx > Clean < Option < WherePredicate > > for ty:: OutlivesPredicate < Ty < ' tcx > , ty:: Region < ' tcx > > {
1371
+ fn clean ( & self , cx : & DocContext ) -> Option < WherePredicate > {
1359
1372
let ty:: OutlivesPredicate ( ref ty, ref lt) = * self ;
1360
1373
1361
- WherePredicate :: BoundPredicate {
1374
+ match lt {
1375
+ ty:: ReEmpty => return None ,
1376
+ _ => { }
1377
+ }
1378
+
1379
+ Some ( WherePredicate :: BoundPredicate {
1362
1380
ty : ty. clean ( cx) ,
1363
1381
bounds : vec ! [ GenericBound :: Outlives ( lt. clean( cx) . expect( "failed to clean lifetimes" ) ) ]
1364
- }
1382
+ } )
1365
1383
}
1366
1384
}
1367
1385
@@ -1578,7 +1596,7 @@ impl<'a, 'tcx> Clean<Generics> for (&'a ty::Generics,
1578
1596
} ) . collect :: < Vec < GenericParamDef > > ( ) ;
1579
1597
1580
1598
let mut where_predicates = preds. predicates . iter ( )
1581
- . map ( |( p, _) | p. clean ( cx) )
1599
+ . flat_map ( |( p, _) | p. clean ( cx) )
1582
1600
. collect :: < Vec < _ > > ( ) ;
1583
1601
1584
1602
// Type parameters and have a Sized bound by default unless removed with
0 commit comments