pass a &mut QueryRegionConstraints
not just outlives constraints
This commit is contained in:
parent
ec560e2c6d
commit
f933e0971b
2 changed files with 12 additions and 10 deletions
|
@ -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_outlives_constraints: &mut Vec<QueryOutlivesConstraint<'tcx>>,
|
||||
output_query_region_constraints: &mut QueryRegionConstraints<'tcx>,
|
||||
) -> InferResult<'tcx, R>
|
||||
where
|
||||
R: Debug + TypeFoldable<'tcx>,
|
||||
|
@ -305,9 +305,11 @@ 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_outlives_constraints
|
||||
output_query_region_constraints
|
||||
.outlives
|
||||
.push(ty::Binder::dummy(ty::OutlivesPredicate(v_o.into(), v_r)));
|
||||
output_query_outlives_constraints
|
||||
output_query_region_constraints
|
||||
.outlives
|
||||
.push(ty::Binder::dummy(ty::OutlivesPredicate(v_r.into(), v_o)));
|
||||
}
|
||||
}
|
||||
|
@ -333,7 +335,7 @@ impl<'cx, 'tcx> InferCtxt<'cx, 'tcx> {
|
|||
}
|
||||
|
||||
// ...also include the other query region constraints from the query.
|
||||
output_query_outlives_constraints.extend(
|
||||
output_query_region_constraints.outlives.extend(
|
||||
query_response.value.region_constraints.outlives.iter().filter_map(|r_c| {
|
||||
let r_c = substitute_value(self.tcx, &result_subst, r_c);
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
use crate::infer::canonical::{
|
||||
Canonical, Canonicalized, CanonicalizedQueryResponse, OriginalQueryValues,
|
||||
QueryRegionConstraints, QueryOutlivesConstraint, QueryResponse,
|
||||
QueryRegionConstraints, QueryResponse,
|
||||
};
|
||||
use crate::infer::{InferCtxt, InferOk};
|
||||
use std::fmt;
|
||||
|
@ -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<QueryOutlivesConstraint<'tcx>>,
|
||||
output_query_region_constraints: &mut QueryRegionConstraints<'tcx>,
|
||||
) -> Fallible<Self::QueryResponse> {
|
||||
if let Some(result) = QueryTypeOp::try_fast_path(infcx.tcx, &query_key) {
|
||||
return Ok(result);
|
||||
|
@ -141,15 +141,15 @@ where
|
|||
self,
|
||||
infcx: &InferCtxt<'_, 'tcx>,
|
||||
) -> Fallible<(Self::Output, Option<Rc<QueryRegionConstraints<'tcx>>>)> {
|
||||
let mut outlives = vec![];
|
||||
let r = Q::fully_perform_into(self, infcx, &mut outlives)?;
|
||||
let mut region_constraints = QueryRegionConstraints::default();
|
||||
let r = Q::fully_perform_into(self, infcx, &mut region_constraints)?;
|
||||
|
||||
// Promote the final query-region-constraints into a
|
||||
// (optional) ref-counted vector:
|
||||
let opt_qrc = if outlives.is_empty() {
|
||||
let opt_qrc = if region_constraints.is_empty() {
|
||||
None
|
||||
} else {
|
||||
Some(Rc::new(QueryRegionConstraints { outlives }))
|
||||
Some(Rc::new(region_constraints))
|
||||
};
|
||||
|
||||
Ok((r, opt_qrc))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue