liveness: substitute bound regions with free ones before normalizing the return type
Fixes #32323
This commit is contained in:
parent
b12b4e4e32
commit
fcaefcfdb0
2 changed files with 21 additions and 1 deletions
|
|
@ -115,6 +115,7 @@ use middle::pat_util;
|
|||
use middle::ty::{self, TyCtxt, ParameterEnvironment};
|
||||
use middle::traits::{self, ProjectionMode};
|
||||
use middle::infer;
|
||||
use middle::subst::Subst;
|
||||
use lint;
|
||||
use util::nodemap::NodeMap;
|
||||
|
||||
|
|
@ -1495,6 +1496,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
|||
if self.live_on_entry(entry_ln, self.s.no_ret_var).is_some() => {
|
||||
|
||||
let param_env = ParameterEnvironment::for_item(&self.ir.tcx, id);
|
||||
let t_ret_subst = t_ret.subst(&self.ir.tcx, ¶m_env.free_substs);
|
||||
let infcx = infer::new_infer_ctxt(&self.ir.tcx,
|
||||
&self.ir.tcx.tables,
|
||||
Some(param_env),
|
||||
|
|
@ -1502,7 +1504,7 @@ impl<'a, 'tcx> Liveness<'a, 'tcx> {
|
|||
let cause = traits::ObligationCause::dummy();
|
||||
let norm = traits::fully_normalize(&infcx,
|
||||
cause,
|
||||
&t_ret);
|
||||
&t_ret_subst);
|
||||
|
||||
if norm.unwrap().is_nil() {
|
||||
// for nil return types, it is ok to not return a value expl.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue