@@ -121,12 +121,12 @@ impl<'tcx> InferCtxt<'tcx> {
121
121
| (
122
122
ty:: Infer ( ty:: TyVar ( _) | ty:: FreshTy ( _) | ty:: FreshIntTy ( _) | ty:: FreshFloatTy ( _) ) ,
123
123
ty:: Alias ( AliasKind :: Projection , _) ,
124
- ) if self . tcx . trait_solver_next ( ) => {
124
+ ) if self . use_new_solver => {
125
125
bug ! ( )
126
126
}
127
127
128
128
( _, ty:: Alias ( AliasKind :: Projection , _) ) | ( ty:: Alias ( AliasKind :: Projection , _) , _)
129
- if self . tcx . trait_solver_next ( ) =>
129
+ if self . use_new_solver =>
130
130
{
131
131
relation. register_type_relate_obligation ( a, b) ;
132
132
Ok ( a)
@@ -242,15 +242,37 @@ impl<'tcx> InferCtxt<'tcx> {
242
242
// FIXME(#59490): Need to remove the leak check to accommodate
243
243
// escaping bound variables here.
244
244
if !a. has_escaping_bound_vars ( ) && !b. has_escaping_bound_vars ( ) {
245
- relation. register_const_equate_obligation ( a, b) ;
245
+ let ( a, b) = if relation. a_is_expected ( ) { ( a, b) } else { ( b, a) } ;
246
+
247
+ // FIXME(deferred_projection_equality): What do here...
248
+ relation. register_predicates ( [ ty:: Binder :: dummy ( if self . use_new_solver {
249
+ ty:: PredicateKind :: AliasRelate (
250
+ a. into ( ) ,
251
+ b. into ( ) ,
252
+ ty:: AliasRelationDirection :: Equate ,
253
+ )
254
+ } else {
255
+ ty:: PredicateKind :: ConstEquate ( a, b)
256
+ } ) ] ) ;
246
257
}
247
258
return Ok ( b) ;
248
259
}
249
260
( _, ty:: ConstKind :: Unevaluated ( ..) ) if self . tcx . lazy_normalization ( ) => {
250
261
// FIXME(#59490): Need to remove the leak check to accommodate
251
262
// escaping bound variables here.
252
263
if !a. has_escaping_bound_vars ( ) && !b. has_escaping_bound_vars ( ) {
253
- relation. register_const_equate_obligation ( a, b) ;
264
+ let ( a, b) = if relation. a_is_expected ( ) { ( a, b) } else { ( b, a) } ;
265
+
266
+ // FIXME(deferred_projection_equality): What do here...
267
+ relation. register_predicates ( [ ty:: Binder :: dummy ( if self . use_new_solver {
268
+ ty:: PredicateKind :: AliasRelate (
269
+ a. into ( ) ,
270
+ b. into ( ) ,
271
+ ty:: AliasRelationDirection :: Equate ,
272
+ )
273
+ } else {
274
+ ty:: PredicateKind :: ConstEquate ( a, b)
275
+ } ) ] ) ;
254
276
}
255
277
return Ok ( a) ;
256
278
}
@@ -835,19 +857,6 @@ pub trait ObligationEmittingRelation<'tcx>: TypeRelation<'tcx> {
835
857
/// be used if control over the obligation causes is required.
836
858
fn register_predicates ( & mut self , obligations : impl IntoIterator < Item : ToPredicate < ' tcx > > ) ;
837
859
838
- /// Register an obligation that both constants must be equal to each other.
839
- ///
840
- /// If they aren't equal then the relation doesn't hold.
841
- fn register_const_equate_obligation ( & mut self , a : ty:: Const < ' tcx > , b : ty:: Const < ' tcx > ) {
842
- let ( a, b) = if self . a_is_expected ( ) { ( a, b) } else { ( b, a) } ;
843
-
844
- self . register_predicates ( [ ty:: Binder :: dummy ( if self . tcx ( ) . trait_solver_next ( ) {
845
- ty:: PredicateKind :: AliasRelate ( a. into ( ) , b. into ( ) , ty:: AliasRelationDirection :: Equate )
846
- } else {
847
- ty:: PredicateKind :: ConstEquate ( a, b)
848
- } ) ] ) ;
849
- }
850
-
851
860
/// Register an obligation that both types must be related to each other according to
852
861
/// the [`ty::AliasRelationDirection`] given by [`ObligationEmittingRelation::alias_relate_direction`]
853
862
fn register_type_relate_obligation ( & mut self , a : Ty < ' tcx > , b : Ty < ' tcx > ) {
0 commit comments