@@ -109,11 +109,11 @@ impl<'tcx> InferCtxt<'tcx> {
109
109
| (
110
110
ty:: Infer ( ty:: TyVar ( _) | ty:: FreshTy ( _) | ty:: FreshIntTy ( _) | ty:: FreshFloatTy ( _) ) ,
111
111
ty:: Alias ( AliasKind :: Projection , _) ,
112
- ) if self . tcx . trait_solver_next ( ) => {
112
+ ) if self . next_trait_solver ( ) => {
113
113
bug ! ( )
114
114
}
115
115
116
- ( _, ty:: Alias ( ..) ) | ( ty:: Alias ( ..) , _) if self . tcx . trait_solver_next ( ) => {
116
+ ( _, ty:: Alias ( ..) ) | ( ty:: Alias ( ..) , _) if self . next_trait_solver ( ) => {
117
117
relation. register_type_relate_obligation ( a, b) ;
118
118
Ok ( a)
119
119
}
@@ -227,9 +227,22 @@ impl<'tcx> InferCtxt<'tcx> {
227
227
return self . unify_const_variable ( vid, a, relation. param_env ( ) ) ;
228
228
}
229
229
( 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 ( ) =>
231
231
{
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
+
233
246
return Ok ( b) ;
234
247
}
235
248
_ => { }
@@ -453,19 +466,6 @@ pub trait ObligationEmittingRelation<'tcx>: TypeRelation<'tcx> {
453
466
/// be used if control over the obligation causes is required.
454
467
fn register_predicates ( & mut self , obligations : impl IntoIterator < Item : ToPredicate < ' tcx > > ) ;
455
468
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
-
469
469
/// Register an obligation that both types must be related to each other according to
470
470
/// the [`ty::AliasRelationDirection`] given by [`ObligationEmittingRelation::alias_relate_direction`]
471
471
fn register_type_relate_obligation ( & mut self , a : Ty < ' tcx > , b : Ty < ' tcx > ) {
0 commit comments