don't evaluate with escaping bound vars
This commit is contained in:
parent
01adb7e98d
commit
d15b00af48
4 changed files with 57 additions and 19 deletions
|
@ -6,7 +6,7 @@ use crate::infer::at::At;
|
|||
use crate::infer::canonical::OriginalQueryValues;
|
||||
use crate::infer::{InferCtxt, InferOk};
|
||||
use crate::traits::error_reporting::InferCtxtExt;
|
||||
use crate::traits::project::needs_normalization;
|
||||
use crate::traits::project::{needs_normalization, BoundVarReplacer, PlaceholderReplacer};
|
||||
use crate::traits::{Obligation, ObligationCause, PredicateObligation, Reveal};
|
||||
use rustc_data_structures::sso::SsoHashMap;
|
||||
use rustc_data_structures::stack::ensure_sufficient_stack;
|
||||
|
@ -283,11 +283,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
|
|||
let tcx = self.infcx.tcx;
|
||||
let infcx = self.infcx;
|
||||
let (data, mapped_regions, mapped_types, mapped_consts) =
|
||||
crate::traits::project::BoundVarReplacer::replace_bound_vars(
|
||||
infcx,
|
||||
&mut self.universes,
|
||||
data,
|
||||
);
|
||||
BoundVarReplacer::replace_bound_vars(infcx, &mut self.universes, data);
|
||||
let data = data.try_fold_with(self)?;
|
||||
|
||||
let mut orig_values = OriginalQueryValues::default();
|
||||
|
@ -313,8 +309,7 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
|
|||
debug!("QueryNormalizer: result = {:#?}", result);
|
||||
debug!("QueryNormalizer: obligations = {:#?}", obligations);
|
||||
self.obligations.extend(obligations);
|
||||
|
||||
let res = crate::traits::project::PlaceholderReplacer::replace_placeholders(
|
||||
let res = PlaceholderReplacer::replace_placeholders(
|
||||
infcx,
|
||||
mapped_regions,
|
||||
mapped_types,
|
||||
|
@ -343,7 +338,13 @@ impl<'cx, 'tcx> FallibleTypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
|
|||
constant: ty::Const<'tcx>,
|
||||
) -> Result<ty::Const<'tcx>, Self::Error> {
|
||||
let constant = constant.try_super_fold_with(self)?;
|
||||
Ok(constant.eval(self.infcx.tcx, self.param_env))
|
||||
debug!(?constant, ?self.param_env);
|
||||
Ok(crate::traits::project::with_replaced_escaping_bound_vars(
|
||||
self.infcx,
|
||||
&mut self.universes,
|
||||
constant,
|
||||
|constant| constant.eval(self.infcx.tcx, self.param_env),
|
||||
))
|
||||
}
|
||||
|
||||
fn try_fold_mir_const(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue