1
1
use rustc_data_structures:: captures:: Captures ;
2
2
use rustc_data_structures:: intern:: Interned ;
3
3
use rustc_hir:: def_id:: DefId ;
4
- use rustc_macros:: {
5
- extension, HashStable , Lift , TyDecodable , TyEncodable , TypeFoldable , TypeVisitable ,
6
- } ;
4
+ use rustc_macros:: { extension, HashStable } ;
7
5
use rustc_type_ir as ir;
8
6
use std:: cmp:: Ordering ;
9
7
@@ -24,6 +22,15 @@ pub type PredicateKind<'tcx> = ir::PredicateKind<TyCtxt<'tcx>>;
24
22
pub type NormalizesTo < ' tcx > = ir:: NormalizesTo < TyCtxt < ' tcx > > ;
25
23
pub type CoercePredicate < ' tcx > = ir:: CoercePredicate < TyCtxt < ' tcx > > ;
26
24
pub type SubtypePredicate < ' tcx > = ir:: SubtypePredicate < TyCtxt < ' tcx > > ;
25
+ pub type OutlivesPredicate < ' tcx , T > = ir:: OutlivesPredicate < TyCtxt < ' tcx > , T > ;
26
+ pub type RegionOutlivesPredicate < ' tcx > = OutlivesPredicate < ' tcx , ty:: Region < ' tcx > > ;
27
+ pub type TypeOutlivesPredicate < ' tcx > = OutlivesPredicate < ' tcx , Ty < ' tcx > > ;
28
+ pub type PolyTraitPredicate < ' tcx > = ty:: Binder < ' tcx , TraitPredicate < ' tcx > > ;
29
+ pub type PolyRegionOutlivesPredicate < ' tcx > = ty:: Binder < ' tcx , RegionOutlivesPredicate < ' tcx > > ;
30
+ pub type PolyTypeOutlivesPredicate < ' tcx > = ty:: Binder < ' tcx , TypeOutlivesPredicate < ' tcx > > ;
31
+ pub type PolySubtypePredicate < ' tcx > = ty:: Binder < ' tcx , SubtypePredicate < ' tcx > > ;
32
+ pub type PolyCoercePredicate < ' tcx > = ty:: Binder < ' tcx , CoercePredicate < ' tcx > > ;
33
+ pub type PolyProjectionPredicate < ' tcx > = ty:: Binder < ' tcx , ProjectionPredicate < ' tcx > > ;
27
34
28
35
/// A statement that can be proven by a trait solver. This includes things that may
29
36
/// show up in where clauses, such as trait predicates and projection predicates,
@@ -405,20 +412,6 @@ impl<'tcx> Clause<'tcx> {
405
412
}
406
413
}
407
414
408
- pub type PolyTraitPredicate < ' tcx > = ty:: Binder < ' tcx , TraitPredicate < ' tcx > > ;
409
-
410
- /// `A: B`
411
- #[ derive( Clone , Copy , PartialEq , Eq , PartialOrd , Ord , Hash , Debug , TyEncodable , TyDecodable ) ]
412
- #[ derive( HashStable , TypeFoldable , TypeVisitable , Lift ) ]
413
- pub struct OutlivesPredicate < A , B > ( pub A , pub B ) ;
414
- pub type RegionOutlivesPredicate < ' tcx > = OutlivesPredicate < ty:: Region < ' tcx > , ty:: Region < ' tcx > > ;
415
- pub type TypeOutlivesPredicate < ' tcx > = OutlivesPredicate < Ty < ' tcx > , ty:: Region < ' tcx > > ;
416
- pub type PolyRegionOutlivesPredicate < ' tcx > = ty:: Binder < ' tcx , RegionOutlivesPredicate < ' tcx > > ;
417
- pub type PolyTypeOutlivesPredicate < ' tcx > = ty:: Binder < ' tcx , TypeOutlivesPredicate < ' tcx > > ;
418
- pub type PolySubtypePredicate < ' tcx > = ty:: Binder < ' tcx , SubtypePredicate < ' tcx > > ;
419
- pub type PolyCoercePredicate < ' tcx > = ty:: Binder < ' tcx , CoercePredicate < ' tcx > > ;
420
- pub type PolyProjectionPredicate < ' tcx > = Binder < ' tcx , ProjectionPredicate < ' tcx > > ;
421
-
422
415
pub trait ToPolyTraitRef < ' tcx > {
423
416
fn to_poly_trait_ref ( & self ) -> PolyTraitRef < ' tcx > ;
424
417
}
@@ -545,10 +538,8 @@ impl<'tcx> UpcastFrom<TyCtxt<'tcx>, PolyRegionOutlivesPredicate<'tcx>> for Predi
545
538
}
546
539
}
547
540
548
- impl < ' tcx > UpcastFrom < TyCtxt < ' tcx > , OutlivesPredicate < Ty < ' tcx > , ty:: Region < ' tcx > > >
549
- for Predicate < ' tcx >
550
- {
551
- fn upcast_from ( from : OutlivesPredicate < Ty < ' tcx > , ty:: Region < ' tcx > > , tcx : TyCtxt < ' tcx > ) -> Self {
541
+ impl < ' tcx > UpcastFrom < TyCtxt < ' tcx > , TypeOutlivesPredicate < ' tcx > > for Predicate < ' tcx > {
542
+ fn upcast_from ( from : TypeOutlivesPredicate < ' tcx > , tcx : TyCtxt < ' tcx > ) -> Self {
552
543
ty:: Binder :: dummy ( PredicateKind :: Clause ( ClauseKind :: TypeOutlives ( from) ) ) . upcast ( tcx)
553
544
}
554
545
}
0 commit comments