@@ -1585,9 +1585,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1585
1585
unevaluated : ty:: Unevaluated < ' tcx > ,
1586
1586
span : Option < Span > ,
1587
1587
) -> EvalToConstValueResult < ' tcx > {
1588
- let param_env = self . tcx . erase_regions ( param_env) ;
1589
1588
let mut substs = unevaluated. substs ( self . tcx ) ;
1590
- substs = self . tcx . erase_regions ( substs) ;
1591
1589
substs = self . resolve_vars_if_possible ( substs) ;
1592
1590
1593
1591
// Postpone the evaluation of constants whose substs depend on inference
@@ -1596,15 +1594,18 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
1596
1594
return Err ( ErrorHandled :: TooGeneric ) ;
1597
1595
}
1598
1596
1597
+ let param_env_erased = self . tcx . erase_regions ( param_env) ;
1598
+ let substs_erased = self . tcx . erase_regions ( substs) ;
1599
+
1599
1600
let unevaluated = ty:: Unevaluated {
1600
1601
def : unevaluated. def ,
1601
- substs_ : Some ( substs ) ,
1602
+ substs_ : Some ( substs_erased ) ,
1602
1603
promoted : unevaluated. promoted ,
1603
1604
} ;
1604
1605
1605
1606
// The return value is the evaluated value which doesn't contain any reference to inference
1606
1607
// variables, thus we don't need to substitute back the original values.
1607
- self . tcx . const_eval_resolve ( param_env , unevaluated, span)
1608
+ self . tcx . const_eval_resolve ( param_env_erased , unevaluated, span)
1608
1609
}
1609
1610
1610
1611
/// If `typ` is a type variable of some kind, resolve it one level
0 commit comments