@@ -3,17 +3,20 @@ use rustc_data_structures::intern::Interned;
33use rustc_hir:: def_id:: DefId ;
44use rustc_macros:: { HashStable , Lift , TyDecodable , TyEncodable , TypeFoldable , TypeVisitable } ;
55use rustc_type_ir:: ClauseKind as IrClauseKind ;
6+ use rustc_type_ir:: CoercePredicate as IrCoercePredicate ;
7+ use rustc_type_ir:: ExistentialProjection as IrExistentialProjection ;
8+ use rustc_type_ir:: ExistentialTraitRef as IrExistentialTraitRef ;
9+ use rustc_type_ir:: NormalizesTo as IrNormalizesTo ;
610use rustc_type_ir:: PredicateKind as IrPredicateKind ;
11+ use rustc_type_ir:: ProjectionPredicate as IrProjectionPredicate ;
12+ use rustc_type_ir:: SubtypePredicate as IrSubtypePredicate ;
713use rustc_type_ir:: TraitPredicate as IrTraitPredicate ;
814use rustc_type_ir:: TraitRef as IrTraitRef ;
9- use rustc_type_ir:: ProjectionPredicate as IrProjectionPredicate ;
10- use rustc_type_ir:: ExistentialTraitRef as IrExistentialTraitRef ;
11- use rustc_type_ir:: ExistentialProjection as IrExistentialProjection ;
1215use std:: cmp:: Ordering ;
1316
1417use crate :: ty:: {
15- self , AliasTy , Binder , DebruijnIndex , DebugWithInfcx , EarlyBinder ,
16- PredicatePolarity , Term , Ty , TyCtxt , TypeFlags , WithCachedTypeInfo ,
18+ self , Binder , DebruijnIndex , DebugWithInfcx , EarlyBinder , PredicatePolarity , Term , Ty , TyCtxt ,
19+ TypeFlags , WithCachedTypeInfo ,
1720} ;
1821
1922pub type TraitRef < ' tcx > = IrTraitRef < TyCtxt < ' tcx > > ;
@@ -23,6 +26,9 @@ pub type ExistentialProjection<'tcx> = IrExistentialProjection<TyCtxt<'tcx>>;
2326pub type TraitPredicate < ' tcx > = IrTraitPredicate < TyCtxt < ' tcx > > ;
2427pub type ClauseKind < ' tcx > = IrClauseKind < TyCtxt < ' tcx > > ;
2528pub type PredicateKind < ' tcx > = IrPredicateKind < TyCtxt < ' tcx > > ;
29+ pub type NormalizesTo < ' tcx > = IrNormalizesTo < TyCtxt < ' tcx > > ;
30+ pub type CoercePredicate < ' tcx > = IrCoercePredicate < TyCtxt < ' tcx > > ;
31+ pub type SubtypePredicate < ' tcx > = IrSubtypePredicate < TyCtxt < ' tcx > > ;
2632
2733/// A statement that can be proven by a trait solver. This includes things that may
2834/// show up in where clauses, such as trait predicates and projection predicates,
@@ -511,25 +517,8 @@ pub type TypeOutlivesPredicate<'tcx> = OutlivesPredicate<Ty<'tcx>, ty::Region<'t
511517pub type PolyRegionOutlivesPredicate < ' tcx > = ty:: Binder < ' tcx , RegionOutlivesPredicate < ' tcx > > ;
512518pub type PolyTypeOutlivesPredicate < ' tcx > = ty:: Binder < ' tcx , TypeOutlivesPredicate < ' tcx > > ;
513519
514- /// Encodes that `a` must be a subtype of `b`. The `a_is_expected` flag indicates
515- /// whether the `a` type is the type that we should label as "expected" when
516- /// presenting user diagnostics.
517- #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug , TyEncodable , TyDecodable ) ]
518- #[ derive( HashStable , TypeFoldable , TypeVisitable , Lift ) ]
519- pub struct SubtypePredicate < ' tcx > {
520- pub a_is_expected : bool ,
521- pub a : Ty < ' tcx > ,
522- pub b : Ty < ' tcx > ,
523- }
524520pub type PolySubtypePredicate < ' tcx > = ty:: Binder < ' tcx , SubtypePredicate < ' tcx > > ;
525521
526- /// Encodes that we have to coerce *from* the `a` type to the `b` type.
527- #[ derive( Clone , Copy , PartialEq , Eq , Hash , Debug , TyEncodable , TyDecodable ) ]
528- #[ derive( HashStable , TypeFoldable , TypeVisitable , Lift ) ]
529- pub struct CoercePredicate < ' tcx > {
530- pub a : Ty < ' tcx > ,
531- pub b : Ty < ' tcx > ,
532- }
533522pub type PolyCoercePredicate < ' tcx > = ty:: Binder < ' tcx , CoercePredicate < ' tcx > > ;
534523
535524pub type PolyProjectionPredicate < ' tcx > = Binder < ' tcx , ProjectionPredicate < ' tcx > > ;
@@ -568,33 +557,6 @@ impl<'tcx> PolyProjectionPredicate<'tcx> {
568557 }
569558}
570559
571- /// Used by the new solver. Unlike a `ProjectionPredicate` this can only be
572- /// proven by actually normalizing `alias`.
573- #[ derive( Copy , Clone , PartialEq , Eq , Hash , TyEncodable , TyDecodable ) ]
574- #[ derive( HashStable , TypeFoldable , TypeVisitable , Lift ) ]
575- pub struct NormalizesTo < ' tcx > {
576- pub alias : AliasTy < ' tcx > ,
577- pub term : Term < ' tcx > ,
578- }
579-
580- impl < ' tcx > NormalizesTo < ' tcx > {
581- pub fn self_ty ( self ) -> Ty < ' tcx > {
582- self . alias . self_ty ( )
583- }
584-
585- pub fn with_self_ty ( self , tcx : TyCtxt < ' tcx > , self_ty : Ty < ' tcx > ) -> NormalizesTo < ' tcx > {
586- Self { alias : self . alias . with_self_ty ( tcx, self_ty) , ..self }
587- }
588-
589- pub fn trait_def_id ( self , tcx : TyCtxt < ' tcx > ) -> DefId {
590- self . alias . trait_def_id ( tcx)
591- }
592-
593- pub fn def_id ( self ) -> DefId {
594- self . alias . def_id
595- }
596- }
597-
598560pub trait ToPolyTraitRef < ' tcx > {
599561 fn to_poly_trait_ref ( & self ) -> PolyTraitRef < ' tcx > ;
600562}
0 commit comments