introduce QueryRegionConstraints
struct (no-op)
This commit is contained in:
parent
fd5f7673a7
commit
7e66a96d58
@ -189,11 +189,16 @@ pub enum CanonicalTyVarKind {
|
|||||||
#[derive(Clone, Debug, HashStable)]
|
#[derive(Clone, Debug, HashStable)]
|
||||||
pub struct QueryResponse<'tcx, R> {
|
pub struct QueryResponse<'tcx, R> {
|
||||||
pub var_values: CanonicalVarValues<'tcx>,
|
pub var_values: CanonicalVarValues<'tcx>,
|
||||||
pub region_constraints: Vec<QueryOutlivesConstraint<'tcx>>,
|
pub region_constraints: QueryRegionConstraints<'tcx>,
|
||||||
pub certainty: Certainty,
|
pub certainty: Certainty,
|
||||||
pub value: R,
|
pub value: R,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[derive(Clone, Debug, Default, HashStable)]
|
||||||
|
pub struct QueryRegionConstraints<'tcx> {
|
||||||
|
outlives: Vec<QueryOutlivesConstraint<'tcx>>,
|
||||||
|
}
|
||||||
|
|
||||||
pub type Canonicalized<'tcx, V> = Canonical<'tcx, V>;
|
pub type Canonicalized<'tcx, V> = Canonical<'tcx, V>;
|
||||||
|
|
||||||
pub type CanonicalizedQueryResponse<'tcx, T> =
|
pub type CanonicalizedQueryResponse<'tcx, T> =
|
||||||
@ -540,6 +545,19 @@ BraceStructLiftImpl! {
|
|||||||
} where R: Lift<'tcx>
|
} where R: Lift<'tcx>
|
||||||
}
|
}
|
||||||
|
|
||||||
|
BraceStructTypeFoldableImpl! {
|
||||||
|
impl<'tcx> TypeFoldable<'tcx> for QueryRegionConstraints<'tcx> {
|
||||||
|
outlives
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BraceStructLiftImpl! {
|
||||||
|
impl<'a, 'tcx> Lift<'tcx> for QueryRegionConstraints<'a> {
|
||||||
|
type Lifted = QueryRegionConstraints<'tcx>;
|
||||||
|
outlives
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl<'tcx> Index<BoundVar> for CanonicalVarValues<'tcx> {
|
impl<'tcx> Index<BoundVar> for CanonicalVarValues<'tcx> {
|
||||||
type Output = Kind<'tcx>;
|
type Output = Kind<'tcx>;
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@ use crate::arena::ArenaAllocatable;
|
|||||||
use crate::infer::canonical::substitute::substitute_value;
|
use crate::infer::canonical::substitute::substitute_value;
|
||||||
use crate::infer::canonical::{
|
use crate::infer::canonical::{
|
||||||
Canonical, CanonicalVarValues, CanonicalizedQueryResponse, Certainty,
|
Canonical, CanonicalVarValues, CanonicalizedQueryResponse, Certainty,
|
||||||
OriginalQueryValues, QueryOutlivesConstraint, QueryResponse,
|
OriginalQueryValues, QueryRegionConstraints, QueryOutlivesConstraint, QueryResponse,
|
||||||
};
|
};
|
||||||
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
|
use crate::infer::region_constraints::{Constraint, RegionConstraintData};
|
||||||
use crate::infer::InferCtxtBuilder;
|
use crate::infer::InferCtxtBuilder;
|
||||||
@ -132,7 +132,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
|||||||
{
|
{
|
||||||
self.canonicalize_response(&QueryResponse {
|
self.canonicalize_response(&QueryResponse {
|
||||||
var_values: inference_vars,
|
var_values: inference_vars,
|
||||||
region_constraints: vec![],
|
region_constraints: QueryRegionConstraints::default(),
|
||||||
certainty: Certainty::Proven, // Ambiguities are OK!
|
certainty: Certainty::Proven, // Ambiguities are OK!
|
||||||
value: answer,
|
value: answer,
|
||||||
})
|
})
|
||||||
@ -173,7 +173,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
|||||||
debug!("ambig_errors = {:#?}", ambig_errors);
|
debug!("ambig_errors = {:#?}", ambig_errors);
|
||||||
|
|
||||||
let region_obligations = self.take_registered_region_obligations();
|
let region_obligations = self.take_registered_region_obligations();
|
||||||
let region_constraints = self.with_region_constraints(|region_constraints| {
|
let outlives_constraints = self.with_region_constraints(|region_constraints| {
|
||||||
make_query_outlives(
|
make_query_outlives(
|
||||||
tcx,
|
tcx,
|
||||||
region_obligations
|
region_obligations
|
||||||
@ -191,7 +191,9 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
|||||||
|
|
||||||
Ok(QueryResponse {
|
Ok(QueryResponse {
|
||||||
var_values: inference_vars,
|
var_values: inference_vars,
|
||||||
region_constraints,
|
region_constraints: QueryRegionConstraints {
|
||||||
|
outlives: outlives_constraints,
|
||||||
|
},
|
||||||
certainty,
|
certainty,
|
||||||
value: answer,
|
value: answer,
|
||||||
})
|
})
|
||||||
@ -225,7 +227,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
|||||||
obligations.extend(self.query_outlives_constraints_into_obligations(
|
obligations.extend(self.query_outlives_constraints_into_obligations(
|
||||||
cause,
|
cause,
|
||||||
param_env,
|
param_env,
|
||||||
&query_response.value.region_constraints,
|
&query_response.value.region_constraints.outlives,
|
||||||
&result_subst,
|
&result_subst,
|
||||||
));
|
));
|
||||||
|
|
||||||
@ -334,7 +336,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
|||||||
|
|
||||||
// ...also include the other query region constraints from the query.
|
// ...also include the other query region constraints from the query.
|
||||||
output_query_outlives_constraints.extend(
|
output_query_outlives_constraints.extend(
|
||||||
query_response.value.region_constraints.iter().filter_map(|r_c| {
|
query_response.value.region_constraints.outlives.iter().filter_map(|r_c| {
|
||||||
let r_c = substitute_value(self.tcx, &result_subst, r_c);
|
let r_c = substitute_value(self.tcx, &result_subst, r_c);
|
||||||
|
|
||||||
// Screen out `'a: 'a` cases -- we skip the binder here but
|
// Screen out `'a: 'a` cases -- we skip the binder here but
|
||||||
|
@ -17,6 +17,7 @@ use rustc::infer::canonical::{
|
|||||||
CanonicalVarValues,
|
CanonicalVarValues,
|
||||||
OriginalQueryValues,
|
OriginalQueryValues,
|
||||||
QueryResponse,
|
QueryResponse,
|
||||||
|
QueryRegionConstraints,
|
||||||
Certainty,
|
Certainty,
|
||||||
};
|
};
|
||||||
use rustc::traits::{
|
use rustc::traits::{
|
||||||
@ -151,14 +152,14 @@ impl context::AggregateOps<ChalkArenas<'tcx>> for ChalkContext<'tcx> {
|
|||||||
let solution = constrained_subst.unchecked_map(|cs| match ambiguous {
|
let solution = constrained_subst.unchecked_map(|cs| match ambiguous {
|
||||||
true => QueryResponse {
|
true => QueryResponse {
|
||||||
var_values: cs.subst.make_identity(self.tcx),
|
var_values: cs.subst.make_identity(self.tcx),
|
||||||
region_constraints: Vec::new(),
|
region_constraints: QueryRegionConstraints::default(),
|
||||||
certainty: Certainty::Ambiguous,
|
certainty: Certainty::Ambiguous,
|
||||||
value: (),
|
value: (),
|
||||||
},
|
},
|
||||||
|
|
||||||
false => QueryResponse {
|
false => QueryResponse {
|
||||||
var_values: cs.subst,
|
var_values: cs.subst,
|
||||||
region_constraints: Vec::new(),
|
region_constraints: QueryRegionConstraints::default(),
|
||||||
|
|
||||||
// FIXME: restore this later once we get better at handling regions
|
// FIXME: restore this later once we get better at handling regions
|
||||||
// region_constraints: cs.constraints
|
// region_constraints: cs.constraints
|
||||||
|
Loading…
x
Reference in New Issue
Block a user