@@ -6,6 +6,7 @@ use rustc_infer::infer::DefineOpaqueTypes;
66use rustc_infer:: traits:: ProjectionCacheKey ;
77use rustc_infer:: traits:: { PolyTraitObligation , SelectionError , TraitEngine } ;
88use rustc_middle:: mir:: interpret:: ErrorHandled ;
9+ use rustc_middle:: traits:: DefiningAnchor ;
910use rustc_middle:: ty:: abstract_const:: NotConstEvaluatable ;
1011use rustc_middle:: ty:: error:: { ExpectedFound , TypeError } ;
1112use rustc_middle:: ty:: GenericArgsRef ;
@@ -623,9 +624,27 @@ impl<'a, 'tcx> ObligationProcessor for FulfillProcessor<'a, 'tcx> {
623624 }
624625 }
625626 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
628631 }
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+ } ,
629648 ty:: PredicateKind :: Clause ( ty:: ClauseKind :: ConstArgHasType ( ct, ty) ) => {
630649 match self . selcx . infcx . at ( & obligation. cause , obligation. param_env ) . eq (
631650 DefineOpaqueTypes :: No ,
0 commit comments