@@ -566,6 +566,11 @@ impl rustc_errors::IntoDiagnosticArg for Clause<'_> {
566
566
pub struct Clause < ' tcx > ( Interned < ' tcx , WithCachedTypeInfo < ty:: Binder < ' tcx , PredicateKind < ' tcx > > > > ) ;
567
567
568
568
impl < ' tcx > Clause < ' tcx > {
569
+ pub fn from_projection_clause ( tcx : TyCtxt < ' tcx > , pred : PolyProjectionPredicate < ' tcx > ) -> Self {
570
+ let pred: Predicate < ' tcx > = pred. to_predicate ( tcx) ;
571
+ pred. expect_clause ( )
572
+ }
573
+
569
574
pub fn as_predicate ( self ) -> Predicate < ' tcx > {
570
575
Predicate ( self . 0 )
571
576
}
@@ -1253,14 +1258,6 @@ impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for TraitRef<'tcx> {
1253
1258
}
1254
1259
}
1255
1260
1256
- impl < ' tcx > ToPredicate < ' tcx , Clause < ' tcx > > for TraitPredicate < ' tcx > {
1257
- #[ inline( always) ]
1258
- fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Clause < ' tcx > {
1259
- let p: Predicate < ' tcx > = self . to_predicate ( tcx) ;
1260
- p. expect_clause ( )
1261
- }
1262
- }
1263
-
1264
1261
impl < ' tcx > ToPredicate < ' tcx > for Binder < ' tcx , TraitRef < ' tcx > > {
1265
1262
#[ inline( always) ]
1266
1263
fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
@@ -1287,18 +1284,6 @@ impl<'tcx> ToPredicate<'tcx, PolyTraitPredicate<'tcx>> for Binder<'tcx, TraitRef
1287
1284
}
1288
1285
}
1289
1286
1290
- impl < ' tcx > ToPredicate < ' tcx , PolyTraitPredicate < ' tcx > > for TraitRef < ' tcx > {
1291
- fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> PolyTraitPredicate < ' tcx > {
1292
- ty:: Binder :: dummy ( self ) . to_predicate ( tcx)
1293
- }
1294
- }
1295
-
1296
- impl < ' tcx > ToPredicate < ' tcx , PolyTraitPredicate < ' tcx > > for TraitPredicate < ' tcx > {
1297
- fn to_predicate ( self , _tcx : TyCtxt < ' tcx > ) -> PolyTraitPredicate < ' tcx > {
1298
- ty:: Binder :: dummy ( self )
1299
- }
1300
- }
1301
-
1302
1287
impl < ' tcx > ToPredicate < ' tcx > for PolyTraitPredicate < ' tcx > {
1303
1288
fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
1304
1289
self . map_bound ( |p| PredicateKind :: Clause ( ClauseKind :: Trait ( p) ) ) . to_predicate ( tcx)
@@ -1312,12 +1297,6 @@ impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for PolyTraitPredicate<'tcx> {
1312
1297
}
1313
1298
}
1314
1299
1315
- impl < ' tcx > ToPredicate < ' tcx > for OutlivesPredicate < ty:: Region < ' tcx > , ty:: Region < ' tcx > > {
1316
- fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
1317
- ty:: Binder :: dummy ( PredicateKind :: Clause ( ClauseKind :: RegionOutlives ( self ) ) ) . to_predicate ( tcx)
1318
- }
1319
- }
1320
-
1321
1300
impl < ' tcx > ToPredicate < ' tcx > for PolyRegionOutlivesPredicate < ' tcx > {
1322
1301
fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
1323
1302
self . map_bound ( |p| PredicateKind :: Clause ( ClauseKind :: RegionOutlives ( p) ) ) . to_predicate ( tcx)
@@ -1330,12 +1309,6 @@ impl<'tcx> ToPredicate<'tcx> for OutlivesPredicate<Ty<'tcx>, ty::Region<'tcx>> {
1330
1309
}
1331
1310
}
1332
1311
1333
- impl < ' tcx > ToPredicate < ' tcx > for PolyTypeOutlivesPredicate < ' tcx > {
1334
- fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
1335
- self . map_bound ( |p| PredicateKind :: Clause ( ClauseKind :: TypeOutlives ( p) ) ) . to_predicate ( tcx)
1336
- }
1337
- }
1338
-
1339
1312
impl < ' tcx > ToPredicate < ' tcx > for ProjectionPredicate < ' tcx > {
1340
1313
fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
1341
1314
ty:: Binder :: dummy ( PredicateKind :: Clause ( ClauseKind :: Projection ( self ) ) ) . to_predicate ( tcx)
@@ -1355,13 +1328,6 @@ impl<'tcx> ToPredicate<'tcx, Clause<'tcx>> for ProjectionPredicate<'tcx> {
1355
1328
}
1356
1329
}
1357
1330
1358
- impl < ' tcx > ToPredicate < ' tcx , Clause < ' tcx > > for PolyProjectionPredicate < ' tcx > {
1359
- fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Clause < ' tcx > {
1360
- let p: Predicate < ' tcx > = self . to_predicate ( tcx) ;
1361
- p. expect_clause ( )
1362
- }
1363
- }
1364
-
1365
1331
impl < ' tcx > ToPredicate < ' tcx > for TraitPredicate < ' tcx > {
1366
1332
fn to_predicate ( self , tcx : TyCtxt < ' tcx > ) -> Predicate < ' tcx > {
1367
1333
PredicateKind :: Clause ( ClauseKind :: Trait ( self ) ) . to_predicate ( tcx)
0 commit comments