compiler: fold by value
This commit is contained in:
@@ -40,7 +40,7 @@ impl<'cx, 'tcx> AtExt<'tcx> for At<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
let mut orig_values = OriginalQueryValues::default();
|
||||
let c_ty = self.infcx.canonicalize_query(&self.param_env.and(ty), &mut orig_values);
|
||||
let c_ty = self.infcx.canonicalize_query(self.param_env.and(ty), &mut orig_values);
|
||||
let span = self.cause.span;
|
||||
debug!("c_ty = {:?}", c_ty);
|
||||
if let Ok(result) = &tcx.dropck_outlives(c_ty) {
|
||||
@@ -53,7 +53,7 @@ impl<'cx, 'tcx> AtExt<'tcx> for At<'cx, 'tcx> {
|
||||
result,
|
||||
)
|
||||
{
|
||||
let ty = self.infcx.resolve_vars_if_possible(&ty);
|
||||
let ty = self.infcx.resolve_vars_if_possible(ty);
|
||||
let kinds = value.into_kinds_reporting_overflows(tcx, span, ty);
|
||||
return InferOk { value: kinds, obligations };
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
||||
) -> Result<EvaluationResult, OverflowError> {
|
||||
let mut _orig_values = OriginalQueryValues::default();
|
||||
let c_pred = self
|
||||
.canonicalize_query(&obligation.param_env.and(obligation.predicate), &mut _orig_values);
|
||||
.canonicalize_query(obligation.param_env.and(obligation.predicate), &mut _orig_values);
|
||||
// Run canonical query. If overflow occurs, rerun from scratch but this time
|
||||
// in standard trait query mode so that overflow is handled appropriately
|
||||
// within `SelectionContext`.
|
||||
|
||||
@@ -19,7 +19,7 @@ use super::NoSolution;
|
||||
pub use rustc_middle::traits::query::NormalizationResult;
|
||||
|
||||
pub trait AtExt<'tcx> {
|
||||
fn normalize<T>(&self, value: &T) -> Result<Normalized<'tcx, T>, NoSolution>
|
||||
fn normalize<T>(&self, value: T) -> Result<Normalized<'tcx, T>, NoSolution>
|
||||
where
|
||||
T: TypeFoldable<'tcx>;
|
||||
}
|
||||
@@ -38,7 +38,7 @@ impl<'cx, 'tcx> AtExt<'tcx> for At<'cx, 'tcx> {
|
||||
/// normalizing, but for now should be used only when we actually
|
||||
/// know that normalization will succeed, since error reporting
|
||||
/// and other details are still "under development".
|
||||
fn normalize<T>(&self, value: &T) -> Result<Normalized<'tcx, T>, NoSolution>
|
||||
fn normalize<T>(&self, value: T) -> Result<Normalized<'tcx, T>, NoSolution>
|
||||
where
|
||||
T: TypeFoldable<'tcx>,
|
||||
{
|
||||
@@ -165,7 +165,7 @@ impl<'cx, 'tcx> TypeFolder<'tcx> for QueryNormalizer<'cx, 'tcx> {
|
||||
// so we cannot canonicalize it.
|
||||
let c_data = self
|
||||
.infcx
|
||||
.canonicalize_hr_query_hack(&self.param_env.and(*data), &mut orig_values);
|
||||
.canonicalize_hr_query_hack(self.param_env.and(*data), &mut orig_values);
|
||||
debug!("QueryNormalizer: c_data = {:#?}", c_data);
|
||||
debug!("QueryNormalizer: orig_values = {:#?}", orig_values);
|
||||
match tcx.normalize_projection_ty(c_data) {
|
||||
|
||||
@@ -51,7 +51,7 @@ impl<'cx, 'tcx> InferCtxtExt<'tcx> for InferCtxt<'cx, 'tcx> {
|
||||
debug!("implied_outlives_bounds(ty = {:?})", ty);
|
||||
|
||||
let mut orig_values = OriginalQueryValues::default();
|
||||
let key = self.canonicalize_query(¶m_env.and(ty), &mut orig_values);
|
||||
let key = self.canonicalize_query(param_env.and(ty), &mut orig_values);
|
||||
let result = match self.tcx.implied_outlives_bounds(key) {
|
||||
Ok(r) => r,
|
||||
Err(NoSolution) => {
|
||||
|
||||
@@ -96,7 +96,7 @@ fn scrape_region_constraints<'tcx, R>(
|
||||
region_obligations
|
||||
.iter()
|
||||
.map(|(_, r_o)| (r_o.sup_type, r_o.sub_region))
|
||||
.map(|(ty, r)| (infcx.resolve_vars_if_possible(&ty), r)),
|
||||
.map(|(ty, r)| (infcx.resolve_vars_if_possible(ty), r)),
|
||||
®ion_constraint_data,
|
||||
);
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Sized + TypeFoldable<'tcx> + 'tcx {
|
||||
// `'static` otherwise.
|
||||
let mut canonical_var_values = OriginalQueryValues::default();
|
||||
let canonical_self =
|
||||
infcx.canonicalize_hr_query_hack(&query_key, &mut canonical_var_values);
|
||||
infcx.canonicalize_hr_query_hack(query_key.clone(), &mut canonical_var_values);
|
||||
let canonical_result = Self::perform_query(infcx.tcx, canonical_self)?;
|
||||
|
||||
let param_env = query_key.param_env;
|
||||
|
||||
Reference in New Issue
Block a user