@@ -326,18 +326,16 @@ impl<'tcx> InferCtxt<'tcx> {
326
326
) -> RelateResult < ' tcx , ty:: Const < ' tcx > > {
327
327
let span =
328
328
self . inner . borrow_mut ( ) . const_unification_table ( ) . probe_value ( target_vid) . origin . span ;
329
- let Generalization { value, needs_wf : _ } = generalize:: generalize (
329
+ // FIXME(generic_const_exprs): Occurs check failures for unevaluated
330
+ // constants and generic expressions are not yet handled correctly.
331
+ let Generalization { value_may_be_infer : value, needs_wf : _ } = generalize:: generalize (
330
332
self ,
331
333
& mut CombineDelegate { infcx : self , span, param_env } ,
332
334
ct,
333
335
target_vid,
334
336
ty:: Variance :: Invariant ,
335
337
) ?;
336
338
337
- // FIXME(generic_const_exprs): Occurs check failures for unevaluated
338
- // constants and generic expressions are not yet handled correctly.
339
- let value = value. may_be_infer ( ) ;
340
-
341
339
self . inner . borrow_mut ( ) . const_unification_table ( ) . union_value (
342
340
target_vid,
343
341
ConstVarValue {
@@ -449,7 +447,7 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
449
447
// `'?2` and `?3` are fresh region/type inference
450
448
// variables. (Down below, we will relate `a_ty <: b_ty`,
451
449
// adding constraints like `'x: '?2` and `?1 <: ?3`.)
452
- let Generalization { value , needs_wf } = generalize:: generalize (
450
+ let Generalization { value_may_be_infer : b_ty , needs_wf } = generalize:: generalize (
453
451
self . infcx ,
454
452
& mut CombineDelegate {
455
453
infcx : self . infcx ,
@@ -461,7 +459,6 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
461
459
ambient_variance,
462
460
) ?;
463
461
464
- let b_ty = value. may_be_infer ( ) ; // we handle this further down.
465
462
self . infcx . inner . borrow_mut ( ) . type_variables ( ) . instantiate ( b_vid, b_ty) ;
466
463
467
464
if needs_wf {
@@ -501,6 +498,11 @@ impl<'infcx, 'tcx> CombineFields<'infcx, 'tcx> {
501
498
}
502
499
}
503
500
}
501
+
502
+ // FIXME: This does not handle subtyping correctly, we should switch to
503
+ // alias-relate in the new solver and could instead create a new inference
504
+ // variable for `a_ty`, emitting `Projection(a_ty, a_infer)` and
505
+ // `a_infer <: b_ty`.
504
506
self . obligations . push ( Obligation :: new (
505
507
self . tcx ( ) ,
506
508
self . trace . cause . clone ( ) ,
0 commit comments