@@ -640,7 +640,25 @@ pub enum PredicateKind<'tcx> {
640640 /// This predicate requires two terms to be equal to eachother.
641641 ///
642642 /// Only used for new solver
643- AliasEq ( Term < ' tcx > , Term < ' tcx > ) ,
643+ AliasEq ( Term < ' tcx > , Term < ' tcx > , AliasRelationDirection ) ,
644+ }
645+
646+ #[ derive( Clone , Copy , PartialEq , Eq , Hash , TyEncodable , TyDecodable ) ]
647+ #[ derive( HashStable , Debug ) ]
648+ pub enum AliasRelationDirection {
649+ Equate ,
650+ Subtype ,
651+ Supertype ,
652+ }
653+
654+ impl AliasRelationDirection {
655+ pub fn invert ( self ) -> Self {
656+ match self {
657+ AliasRelationDirection :: Equate => AliasRelationDirection :: Equate ,
658+ AliasRelationDirection :: Subtype => AliasRelationDirection :: Supertype ,
659+ AliasRelationDirection :: Supertype => AliasRelationDirection :: Subtype ,
660+ }
661+ }
644662}
645663
646664/// The crate outlives map is computed during typeck and contains the
@@ -976,11 +994,11 @@ impl<'tcx> Term<'tcx> {
976994 }
977995 }
978996
979- /// This function returns `None` for `AliasKind::Opaque` .
997+ /// This function returns the inner `AliasTy` if this term is a projection .
980998 ///
981999 /// FIXME: rename `AliasTy` to `AliasTerm` and make sure we correctly
9821000 /// deal with constants.
983- pub fn to_alias_term_no_opaque ( & self , tcx : TyCtxt < ' tcx > ) -> Option < AliasTy < ' tcx > > {
1001+ pub fn to_projection_term ( & self , tcx : TyCtxt < ' tcx > ) -> Option < AliasTy < ' tcx > > {
9841002 match self . unpack ( ) {
9851003 TermKind :: Ty ( ty) => match ty. kind ( ) {
9861004 ty:: Alias ( kind, alias_ty) => match kind {
0 commit comments