@@ -109,11 +109,11 @@ impl<'tcx> InferCtxt<'tcx> {
109109 | (
110110 ty:: Infer ( ty:: TyVar ( _) | ty:: FreshTy ( _) | ty:: FreshIntTy ( _) | ty:: FreshFloatTy ( _) ) ,
111111 ty:: Alias ( AliasKind :: Projection , _) ,
112- ) if self . tcx . trait_solver_next ( ) => {
112+ ) if self . next_trait_solver ( ) => {
113113 bug ! ( )
114114 }
115115
116- ( _, ty:: Alias ( ..) ) | ( ty:: Alias ( ..) , _) if self . tcx . trait_solver_next ( ) => {
116+ ( _, ty:: Alias ( ..) ) | ( ty:: Alias ( ..) , _) if self . next_trait_solver ( ) => {
117117 relation. register_type_relate_obligation ( a, b) ;
118118 Ok ( a)
119119 }
@@ -227,9 +227,22 @@ impl<'tcx> InferCtxt<'tcx> {
227227 return self . unify_const_variable ( vid, a, relation. param_env ( ) ) ;
228228 }
229229 ( ty:: ConstKind :: Unevaluated ( ..) , _) | ( _, ty:: ConstKind :: Unevaluated ( ..) )
230- if self . tcx . features ( ) . generic_const_exprs || self . tcx . trait_solver_next ( ) =>
230+ if self . tcx . features ( ) . generic_const_exprs || self . next_trait_solver ( ) =>
231231 {
232- relation. register_const_equate_obligation ( a, b) ;
232+ let ( a, b) = if relation. a_is_expected ( ) { ( a, b) } else { ( b, a) } ;
233+
234+ relation. register_predicates ( [ ty:: Binder :: dummy (
235+ if self . next_trait_solver ( ) {
236+ ty:: PredicateKind :: AliasRelate (
237+ a. into ( ) ,
238+ b. into ( ) ,
239+ ty:: AliasRelationDirection :: Equate ,
240+ )
241+ } else {
242+ ty:: PredicateKind :: ConstEquate ( a, b)
243+ } ,
244+ ) ] ) ;
245+
233246 return Ok ( b) ;
234247 }
235248 _ => { }
@@ -453,19 +466,6 @@ pub trait ObligationEmittingRelation<'tcx>: TypeRelation<'tcx> {
453466 /// be used if control over the obligation causes is required.
454467 fn register_predicates ( & mut self , obligations : impl IntoIterator < Item : ToPredicate < ' tcx > > ) ;
455468
456- /// Register an obligation that both constants must be equal to each other.
457- ///
458- /// If they aren't equal then the relation doesn't hold.
459- fn register_const_equate_obligation ( & mut self , a : ty:: Const < ' tcx > , b : ty:: Const < ' tcx > ) {
460- let ( a, b) = if self . a_is_expected ( ) { ( a, b) } else { ( b, a) } ;
461-
462- self . register_predicates ( [ ty:: Binder :: dummy ( if self . tcx ( ) . trait_solver_next ( ) {
463- ty:: PredicateKind :: AliasRelate ( a. into ( ) , b. into ( ) , ty:: AliasRelationDirection :: Equate )
464- } else {
465- ty:: PredicateKind :: ConstEquate ( a, b)
466- } ) ] ) ;
467- }
468-
469469 /// Register an obligation that both types must be related to each other according to
470470 /// the [`ty::AliasRelationDirection`] given by [`ObligationEmittingRelation::alias_relate_direction`]
471471 fn register_type_relate_obligation ( & mut self , a : Ty < ' tcx > , b : Ty < ' tcx > ) {
0 commit comments