rename QueryRegionConstraint
to QueryOutlivesConstraint
This commit is contained in:
parent
d6ec0ae777
commit
fd5f7673a7
@ -189,7 +189,7 @@ pub enum CanonicalTyVarKind {
|
||||
#[derive(Clone, Debug, HashStable)]
|
||||
pub struct QueryResponse<'tcx, R> {
|
||||
pub var_values: CanonicalVarValues<'tcx>,
|
||||
pub region_constraints: Vec<QueryRegionConstraint<'tcx>>,
|
||||
pub region_constraints: Vec<QueryOutlivesConstraint<'tcx>>,
|
||||
pub certainty: Certainty,
|
||||
pub value: R,
|
||||
}
|
||||
@ -292,7 +292,7 @@ impl<'tcx, V> Canonical<'tcx, V> {
|
||||
}
|
||||
}
|
||||
|
||||
pub type QueryRegionConstraint<'tcx> = ty::Binder<ty::OutlivesPredicate<Kind<'tcx>, Region<'tcx>>>;
|
||||
pub type QueryOutlivesConstraint<'tcx> = ty::Binder<ty::OutlivesPredicate<Kind<'tcx>, Region<'tcx>>>;
|
||||
|
||||
impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
/// Creates a substitution S for the canonical value with fresh
|
||||
|
@ -11,7 +11,7 @@ use crate::arena::ArenaAllocatable;
|
||||
use crate::infer::canonical::substitute::substitute_value;
|
||||
use crate::infer::canonical::{
|
||||
Canonical, CanonicalVarValues, CanonicalizedQueryResponse, Certainty,
|
||||
OriginalQueryValues, QueryRegionConstraint, QueryResponse,
|
||||
OriginalQueryValues, QueryOutlivesConstraint, QueryResponse,
|
||||
};
|
||||
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
|
||||
use crate::infer::InferCtxtBuilder;
|
||||
@ -222,7 +222,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
mut obligations,
|
||||
} = self.query_response_substitution(cause, param_env, original_values, query_response)?;
|
||||
|
||||
obligations.extend(self.query_region_constraints_into_obligations(
|
||||
obligations.extend(self.query_outlives_constraints_into_obligations(
|
||||
cause,
|
||||
param_env,
|
||||
&query_response.value.region_constraints,
|
||||
@ -248,9 +248,9 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
/// that come out of these queries, which it wants to convert into
|
||||
/// MIR-based constraints and solve. Therefore, it is most
|
||||
/// convenient for the NLL Type Checker to **directly consume**
|
||||
/// the `QueryRegionConstraint` values that arise from doing a
|
||||
/// the `QueryOutlivesConstraint` values that arise from doing a
|
||||
/// query. This is contrast to other parts of the compiler, which
|
||||
/// would prefer for those `QueryRegionConstraint` to be converted
|
||||
/// would prefer for those `QueryOutlivesConstraint` to be converted
|
||||
/// into the older infcx-style constraints (e.g., calls to
|
||||
/// `sub_regions` or `register_region_obligation`).
|
||||
///
|
||||
@ -263,7 +263,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
/// result. If any errors arise, they are propagated back as an
|
||||
/// `Err` result.
|
||||
/// - In the case of a successful substitution, we will append
|
||||
/// `QueryRegionConstraint` values onto the
|
||||
/// `QueryOutlivesConstraint` values onto the
|
||||
/// `output_query_region_constraints` vector for the solver to
|
||||
/// use (if an error arises, some values may also be pushed, but
|
||||
/// they should be ignored).
|
||||
@ -279,7 +279,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
original_values: &OriginalQueryValues<'tcx>,
|
||||
query_response: &Canonical<'tcx, QueryResponse<'tcx, R>>,
|
||||
output_query_region_constraints: &mut Vec<QueryRegionConstraint<'tcx>>,
|
||||
output_query_outlives_constraints: &mut Vec<QueryOutlivesConstraint<'tcx>>,
|
||||
) -> InferResult<'tcx, R>
|
||||
where
|
||||
R: Debug + TypeFoldable<'tcx>,
|
||||
@ -287,7 +287,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
let result_subst =
|
||||
self.query_response_substitution_guess(cause, original_values, query_response);
|
||||
|
||||
// Compute `QueryRegionConstraint` values that unify each of
|
||||
// Compute `QueryOutlivesConstraint` values that unify each of
|
||||
// the original values `v_o` that was canonicalized into a
|
||||
// variable...
|
||||
let mut obligations = vec![];
|
||||
@ -305,9 +305,9 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
(UnpackedKind::Lifetime(v_o), UnpackedKind::Lifetime(v_r)) => {
|
||||
// To make `v_o = v_r`, we emit `v_o: v_r` and `v_r: v_o`.
|
||||
if v_o != v_r {
|
||||
output_query_region_constraints
|
||||
output_query_outlives_constraints
|
||||
.push(ty::Binder::dummy(ty::OutlivesPredicate(v_o.into(), v_r)));
|
||||
output_query_region_constraints
|
||||
output_query_outlives_constraints
|
||||
.push(ty::Binder::dummy(ty::OutlivesPredicate(v_r.into(), v_o)));
|
||||
}
|
||||
}
|
||||
@ -333,7 +333,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
}
|
||||
|
||||
// ...also include the other query region constraints from the query.
|
||||
output_query_region_constraints.extend(
|
||||
output_query_outlives_constraints.extend(
|
||||
query_response.value.region_constraints.iter().filter_map(|r_c| {
|
||||
let r_c = substitute_value(self.tcx, &result_subst, r_c);
|
||||
|
||||
@ -560,11 +560,11 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
||||
|
||||
/// Converts the region constraints resulting from a query into an
|
||||
/// iterator of obligations.
|
||||
fn query_region_constraints_into_obligations<'a>(
|
||||
fn query_outlives_constraints_into_obligations<'a>(
|
||||
&'a self,
|
||||
cause: &'a ObligationCause<'tcx>,
|
||||
param_env: ty::ParamEnv<'tcx>,
|
||||
unsubstituted_region_constraints: &'a [QueryRegionConstraint<'tcx>],
|
||||
unsubstituted_region_constraints: &'a [QueryOutlivesConstraint<'tcx>],
|
||||
result_subst: &'a CanonicalVarValues<'tcx>,
|
||||
) -> impl Iterator<Item = PredicateObligation<'tcx>> + 'a + Captures<'tcx> {
|
||||
unsubstituted_region_constraints
|
||||
@ -649,7 +649,7 @@ pub fn make_query_outlives<'tcx>(
|
||||
tcx: TyCtxt<'tcx>,
|
||||
outlives_obligations: impl Iterator<Item = (Ty<'tcx>, ty::Region<'tcx>)>,
|
||||
region_constraints: &RegionConstraintData<'tcx>,
|
||||
) -> Vec<QueryRegionConstraint<'tcx>> {
|
||||
) -> Vec<QueryOutlivesConstraint<'tcx>> {
|
||||
let RegionConstraintData {
|
||||
constraints,
|
||||
verifys,
|
||||
|
@ -500,7 +500,7 @@ impl<'a, 'tcx> InferCtxt<'a, 'tcx> {
|
||||
}
|
||||
|
||||
pub fn report_unexpected_hidden_region(
|
||||
tcx: TyCtxt<'_, '_, 'tcx>,
|
||||
tcx: TyCtxt<'tcx>,
|
||||
region_scope_tree: Option<®ion::ScopeTree>,
|
||||
opaque_type_def_id: DefId,
|
||||
hidden_ty: Ty<'tcx>,
|
||||
|
@ -3,7 +3,7 @@ use std::fmt;
|
||||
use crate::traits::query::Fallible;
|
||||
|
||||
use crate::infer::canonical::query_response;
|
||||
use crate::infer::canonical::QueryRegionConstraint;
|
||||
use crate::infer::canonical::QueryOutlivesConstraint;
|
||||
use std::rc::Rc;
|
||||
use syntax::source_map::DUMMY_SP;
|
||||
use crate::traits::{ObligationCause, TraitEngine, TraitEngineExt};
|
||||
@ -39,7 +39,7 @@ where
|
||||
fn fully_perform(
|
||||
self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
) -> Fallible<(Self::Output, Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>)> {
|
||||
) -> Fallible<(Self::Output, Option<Rc<Vec<QueryOutlivesConstraint<'tcx>>>>)> {
|
||||
if cfg!(debug_assertions) {
|
||||
info!("fully_perform({:?})", self);
|
||||
}
|
||||
@ -62,7 +62,7 @@ where
|
||||
fn scrape_region_constraints<'tcx, R>(
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
op: impl FnOnce() -> Fallible<InferOk<'tcx, R>>,
|
||||
) -> Fallible<(R, Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>)> {
|
||||
) -> Fallible<(R, Option<Rc<Vec<QueryOutlivesConstraint<'tcx>>>>)> {
|
||||
let mut fulfill_cx = TraitEngine::new(infcx.tcx);
|
||||
let dummy_body_id = ObligationCause::dummy().body_id;
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
use crate::infer::canonical::{
|
||||
Canonical, Canonicalized, CanonicalizedQueryResponse, OriginalQueryValues,
|
||||
QueryRegionConstraint, QueryResponse,
|
||||
QueryOutlivesConstraint, QueryResponse,
|
||||
};
|
||||
use crate::infer::{InferCtxt, InferOk};
|
||||
use std::fmt;
|
||||
@ -32,7 +32,7 @@ pub trait TypeOp<'tcx>: Sized + fmt::Debug {
|
||||
fn fully_perform(
|
||||
self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
) -> Fallible<(Self::Output, Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>)>;
|
||||
) -> Fallible<(Self::Output, Option<Rc<Vec<QueryOutlivesConstraint<'tcx>>>>)>;
|
||||
}
|
||||
|
||||
/// "Query type ops" are type ops that are implemented using a
|
||||
@ -85,7 +85,7 @@ pub trait QueryTypeOp<'tcx>: fmt::Debug + Sized + TypeFoldable<'tcx> + 'tcx {
|
||||
fn fully_perform_into(
|
||||
query_key: ParamEnvAnd<'tcx, Self>,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
output_query_region_constraints: &mut Vec<QueryRegionConstraint<'tcx>>,
|
||||
output_query_region_constraints: &mut Vec<QueryOutlivesConstraint<'tcx>>,
|
||||
) -> Fallible<Self::QueryResponse> {
|
||||
if let Some(result) = QueryTypeOp::try_fast_path(infcx.tcx, &query_key) {
|
||||
return Ok(result);
|
||||
@ -140,7 +140,7 @@ where
|
||||
fn fully_perform(
|
||||
self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
) -> Fallible<(Self::Output, Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>)> {
|
||||
) -> Fallible<(Self::Output, Option<Rc<Vec<QueryOutlivesConstraint<'tcx>>>>)> {
|
||||
let mut qrc = vec![];
|
||||
let r = Q::fully_perform_into(self, infcx, &mut qrc)?;
|
||||
|
||||
|
@ -8,7 +8,7 @@ use crate::borrow_check::Upvar;
|
||||
use crate::borrow_check::nll::type_check::free_region_relations::UniversalRegionRelations;
|
||||
use crate::borrow_check::nll::type_check::Locations;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::infer::canonical::QueryRegionConstraint;
|
||||
use rustc::infer::canonical::QueryOutlivesConstraint;
|
||||
use rustc::infer::region_constraints::{GenericKind, VarInfos, VerifyBound};
|
||||
use rustc::infer::{InferCtxt, NLLRegionVariableOrigin, RegionVariableOrigin};
|
||||
use rustc::mir::{
|
||||
@ -1372,7 +1372,7 @@ pub trait ClosureRegionRequirementsExt<'tcx> {
|
||||
tcx: TyCtxt<'tcx>,
|
||||
closure_def_id: DefId,
|
||||
closure_substs: SubstsRef<'tcx>,
|
||||
) -> Vec<QueryRegionConstraint<'tcx>>;
|
||||
) -> Vec<QueryOutlivesConstraint<'tcx>>;
|
||||
|
||||
fn subst_closure_mapping<T>(
|
||||
&self,
|
||||
@ -1402,7 +1402,7 @@ impl<'tcx> ClosureRegionRequirementsExt<'tcx> for ClosureRegionRequirements<'tcx
|
||||
tcx: TyCtxt<'tcx>,
|
||||
closure_def_id: DefId,
|
||||
closure_substs: SubstsRef<'tcx>,
|
||||
) -> Vec<QueryRegionConstraint<'tcx>> {
|
||||
) -> Vec<QueryOutlivesConstraint<'tcx>> {
|
||||
debug!(
|
||||
"apply_requirements(closure_def_id={:?}, closure_substs={:?})",
|
||||
closure_def_id, closure_substs
|
||||
|
@ -3,7 +3,7 @@ use crate::borrow_check::nll::region_infer::TypeTest;
|
||||
use crate::borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints};
|
||||
use crate::borrow_check::nll::universal_regions::UniversalRegions;
|
||||
use crate::borrow_check::nll::ToRegionVid;
|
||||
use rustc::infer::canonical::QueryRegionConstraint;
|
||||
use rustc::infer::canonical::QueryOutlivesConstraint;
|
||||
use rustc::infer::outlives::env::RegionBoundPairs;
|
||||
use rustc::infer::outlives::obligations::{TypeOutlives, TypeOutlivesDelegate};
|
||||
use rustc::infer::region_constraints::{GenericKind, VerifyBound};
|
||||
@ -49,13 +49,13 @@ impl<'a, 'tcx> ConstraintConversion<'a, 'tcx> {
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn convert_all(&mut self, query_constraints: &[QueryRegionConstraint<'tcx>]) {
|
||||
pub(super) fn convert_all(&mut self, query_constraints: &[QueryOutlivesConstraint<'tcx>]) {
|
||||
for query_constraint in query_constraints {
|
||||
self.convert(query_constraint);
|
||||
}
|
||||
}
|
||||
|
||||
pub(super) fn convert(&mut self, query_constraint: &QueryRegionConstraint<'tcx>) {
|
||||
pub(super) fn convert(&mut self, query_constraint: &QueryOutlivesConstraint<'tcx>) {
|
||||
debug!("generate: constraints at: {:#?}", self.locations);
|
||||
|
||||
// Extract out various useful fields we'll need below.
|
||||
|
@ -2,7 +2,7 @@ use crate::borrow_check::nll::type_check::constraint_conversion;
|
||||
use crate::borrow_check::nll::type_check::{Locations, MirTypeckRegionConstraints};
|
||||
use crate::borrow_check::nll::universal_regions::UniversalRegions;
|
||||
use crate::borrow_check::nll::ToRegionVid;
|
||||
use rustc::infer::canonical::QueryRegionConstraint;
|
||||
use rustc::infer::canonical::QueryOutlivesConstraint;
|
||||
use rustc::infer::outlives::free_region_map::FreeRegionRelations;
|
||||
use rustc::infer::region_constraints::GenericKind;
|
||||
use rustc::infer::InferCtxt;
|
||||
@ -311,7 +311,7 @@ impl UniversalRegionRelationsBuilder<'cx, 'tcx> {
|
||||
/// either the return type of the MIR or one of its arguments. At
|
||||
/// the same time, compute and add any implied bounds that come
|
||||
/// from this local.
|
||||
fn add_implied_bounds(&mut self, ty: Ty<'tcx>) -> Option<Rc<Vec<QueryRegionConstraint<'tcx>>>> {
|
||||
fn add_implied_bounds(&mut self, ty: Ty<'tcx>) -> Option<Rc<Vec<QueryOutlivesConstraint<'tcx>>>> {
|
||||
debug!("add_implied_bounds(ty={:?})", ty);
|
||||
let (bounds, constraints) =
|
||||
self.param_env
|
||||
|
@ -6,7 +6,7 @@ use crate::borrow_check::nll::type_check::TypeChecker;
|
||||
use crate::dataflow::indexes::MovePathIndex;
|
||||
use crate::dataflow::move_paths::MoveData;
|
||||
use crate::dataflow::{FlowAtLocation, FlowsAtLocation, MaybeInitializedPlaces};
|
||||
use rustc::infer::canonical::QueryRegionConstraint;
|
||||
use rustc::infer::canonical::QueryOutlivesConstraint;
|
||||
use rustc::mir::{BasicBlock, ConstraintCategory, Local, Location, Body};
|
||||
use rustc::traits::query::dropck_outlives::DropckOutlivesResult;
|
||||
use rustc::traits::query::type_op::outlives::DropckOutlives;
|
||||
@ -88,7 +88,7 @@ struct LivenessContext<'me, 'typeck, 'flow, 'tcx> {
|
||||
|
||||
struct DropData<'tcx> {
|
||||
dropck_result: DropckOutlivesResult<'tcx>,
|
||||
region_constraint_data: Option<Rc<Vec<QueryRegionConstraint<'tcx>>>>,
|
||||
region_constraint_data: Option<Rc<Vec<QueryOutlivesConstraint<'tcx>>>>,
|
||||
}
|
||||
|
||||
struct LivenessResults<'me, 'typeck, 'flow, 'tcx> {
|
||||
|
@ -23,7 +23,7 @@ use crate::dataflow::MaybeInitializedPlaces;
|
||||
use either::Either;
|
||||
use rustc::hir;
|
||||
use rustc::hir::def_id::DefId;
|
||||
use rustc::infer::canonical::QueryRegionConstraint;
|
||||
use rustc::infer::canonical::QueryOutlivesConstraint;
|
||||
use rustc::infer::outlives::env::RegionBoundPairs;
|
||||
use rustc::infer::{InferCtxt, InferOk, LateBoundRegionConversionTime, NLLRegionVariableOrigin};
|
||||
use rustc::infer::type_variable::{TypeVariableOrigin, TypeVariableOriginKind};
|
||||
@ -1093,7 +1093,7 @@ impl<'a, 'tcx> TypeChecker<'a, 'tcx> {
|
||||
&mut self,
|
||||
locations: Locations,
|
||||
category: ConstraintCategory,
|
||||
data: &[QueryRegionConstraint<'tcx>],
|
||||
data: &[QueryOutlivesConstraint<'tcx>],
|
||||
) {
|
||||
debug!(
|
||||
"push_region_constraints: constraints generated at {:?} are {:#?}",
|
||||
|
Loading…
x
Reference in New Issue
Block a user