@@ -640,7 +640,25 @@ pub enum PredicateKind<'tcx> {
640
640
/// This predicate requires two terms to be equal to eachother.
641
641
///
642
642
/// 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
+ }
644
662
}
645
663
646
664
/// The crate outlives map is computed during typeck and contains the
@@ -976,11 +994,11 @@ impl<'tcx> Term<'tcx> {
976
994
}
977
995
}
978
996
979
- /// This function returns `None` for `AliasKind::Opaque` .
997
+ /// This function returns the inner `AliasTy` if this term is a projection .
980
998
///
981
999
/// FIXME: rename `AliasTy` to `AliasTerm` and make sure we correctly
982
1000
/// 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 > > {
984
1002
match self . unpack ( ) {
985
1003
TermKind :: Ty ( ty) => match ty. kind ( ) {
986
1004
ty:: Alias ( kind, alias_ty) => match kind {
0 commit comments