@@ -6,6 +6,7 @@ use rustc_infer::infer::DefineOpaqueTypes;
6
6
use rustc_infer:: traits:: ProjectionCacheKey ;
7
7
use rustc_infer:: traits:: { PolyTraitObligation , SelectionError , TraitEngine } ;
8
8
use rustc_middle:: mir:: interpret:: ErrorHandled ;
9
+ use rustc_middle:: traits:: DefiningAnchor ;
9
10
use rustc_middle:: ty:: abstract_const:: NotConstEvaluatable ;
10
11
use rustc_middle:: ty:: error:: { ExpectedFound , TypeError } ;
11
12
use rustc_middle:: ty:: GenericArgsRef ;
@@ -623,9 +624,27 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
623
624
}
624
625
}
625
626
ty:: PredicateKind :: Ambiguous => ProcessResult :: Unchanged ,
626
- ty:: PredicateKind :: AliasRelate ( ..) => {
627
- bug ! ( "AliasRelate is only used for new solver" )
627
+ ty:: PredicateKind :: AliasRelate ( ..)
628
+ if matches ! ( self . selcx. infcx. defining_use_anchor, DefiningAnchor :: Bubble ) =>
629
+ {
630
+ ProcessResult :: Unchanged
628
631
}
632
+ ty:: PredicateKind :: AliasRelate ( a, b, relate) => match relate {
633
+ ty:: AliasRelationDirection :: Equate => match self
634
+ . selcx
635
+ . infcx
636
+ . at ( & obligation. cause , obligation. param_env )
637
+ . eq ( DefineOpaqueTypes :: Yes , a, b)
638
+ {
639
+ Ok ( inf_ok) => ProcessResult :: Changed ( mk_pending ( inf_ok. into_obligations ( ) ) ) ,
640
+ Err ( _) => ProcessResult :: Error ( FulfillmentErrorCode :: CodeSelectionError (
641
+ SelectionError :: Unimplemented ,
642
+ ) ) ,
643
+ } ,
644
+ ty:: AliasRelationDirection :: Subtype => {
645
+ bug ! ( "AliasRelate with subtyping is only used for new solver" )
646
+ }
647
+ } ,
629
648
ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
630
649
match self . selcx . infcx . at ( & obligation. cause , obligation. param_env ) . eq (
631
650
DefineOpaqueTypes :: No ,
0 commit comments