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