rename ConstraintSet to OutlivesConstraintSet
This commit is contained in:
parent
ddc63ce19f
commit
6ead1c8699
5 changed files with 20 additions and 20 deletions
|
|
@ -1,6 +1,6 @@
|
|||
use crate::borrow_check::nll::type_check::Locations;
|
||||
use crate::borrow_check::nll::constraints::OutlivesConstraintIndex;
|
||||
use crate::borrow_check::nll::constraints::{ConstraintSet, OutlivesConstraint};
|
||||
use crate::borrow_check::nll::constraints::{OutlivesConstraintSet, OutlivesConstraint};
|
||||
use rustc::mir::ConstraintCategory;
|
||||
use rustc::ty::RegionVid;
|
||||
use rustc_data_structures::graph;
|
||||
|
|
@ -77,7 +77,7 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
|
|||
/// reporting.
|
||||
crate fn new(
|
||||
direction: D,
|
||||
set: &ConstraintSet,
|
||||
set: &OutlivesConstraintSet,
|
||||
num_region_vars: usize,
|
||||
) -> Self {
|
||||
let mut first_constraints = IndexVec::from_elem_n(None, num_region_vars);
|
||||
|
|
@ -103,7 +103,7 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
|
|||
/// and not constraints.
|
||||
crate fn region_graph<'rg>(
|
||||
&'rg self,
|
||||
set: &'rg ConstraintSet,
|
||||
set: &'rg OutlivesConstraintSet,
|
||||
static_region: RegionVid,
|
||||
) -> RegionGraph<'rg, D> {
|
||||
RegionGraph::new(set, self, static_region)
|
||||
|
|
@ -113,7 +113,7 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
|
|||
crate fn outgoing_edges<'a>(
|
||||
&'a self,
|
||||
region_sup: RegionVid,
|
||||
constraints: &'a ConstraintSet,
|
||||
constraints: &'a OutlivesConstraintSet,
|
||||
static_region: RegionVid,
|
||||
) -> Edges<'a, D> {
|
||||
//if this is the `'static` region and the graph's direction is normal,
|
||||
|
|
@ -142,7 +142,7 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
|
|||
|
||||
crate struct Edges<'s, D: ConstraintGraphDirecton> {
|
||||
graph: &'s ConstraintGraph<D>,
|
||||
constraints: &'s ConstraintSet,
|
||||
constraints: &'s OutlivesConstraintSet,
|
||||
pointer: Option<OutlivesConstraintIndex>,
|
||||
next_static_idx: Option<usize>,
|
||||
static_region: RegionVid,
|
||||
|
|
@ -180,7 +180,7 @@ impl<'s, D: ConstraintGraphDirecton> Iterator for Edges<'s, D> {
|
|||
/// reverse) constraint graph. It implements the graph traits and is
|
||||
/// usd for doing the SCC computation.
|
||||
crate struct RegionGraph<'s, D: ConstraintGraphDirecton> {
|
||||
set: &'s ConstraintSet,
|
||||
set: &'s OutlivesConstraintSet,
|
||||
constraint_graph: &'s ConstraintGraph<D>,
|
||||
static_region: RegionVid,
|
||||
}
|
||||
|
|
@ -191,7 +191,7 @@ impl<'s, D: ConstraintGraphDirecton> RegionGraph<'s, D> {
|
|||
/// construct SCCs for region inference but also for error
|
||||
/// reporting.
|
||||
crate fn new(
|
||||
set: &'s ConstraintSet,
|
||||
set: &'s OutlivesConstraintSet,
|
||||
constraint_graph: &'s ConstraintGraph<D>,
|
||||
static_region: RegionVid,
|
||||
) -> Self {
|
||||
|
|
|
|||
|
|
@ -13,14 +13,14 @@ crate mod graph;
|
|||
/// a unique `OutlivesConstraintIndex` and you can index into the set
|
||||
/// (`constraint_set[i]`) to access the constraint details.
|
||||
#[derive(Clone, Default)]
|
||||
crate struct ConstraintSet {
|
||||
crate struct OutlivesConstraintSet {
|
||||
outlives: IndexVec<OutlivesConstraintIndex, OutlivesConstraint>,
|
||||
}
|
||||
|
||||
impl ConstraintSet {
|
||||
impl OutlivesConstraintSet {
|
||||
crate fn push(&mut self, constraint: OutlivesConstraint) {
|
||||
debug!(
|
||||
"ConstraintSet::push({:?}: {:?} @ {:?}",
|
||||
"OutlivesConstraintSet::push({:?}: {:?} @ {:?}",
|
||||
constraint.sup, constraint.sub, constraint.locations
|
||||
);
|
||||
if constraint.sup == constraint.sub {
|
||||
|
|
@ -34,7 +34,7 @@ impl ConstraintSet {
|
|||
/// easy to find the constraints affecting a particular region.
|
||||
///
|
||||
/// N.B., this graph contains a "frozen" view of the current
|
||||
/// constraints. Any new constraints added to the `ConstraintSet`
|
||||
/// constraints. Any new constraints added to the `OutlivesConstraintSet`
|
||||
/// after the graph is built will not be present in the graph.
|
||||
crate fn graph(&self, num_region_vars: usize) -> graph::NormalConstraintGraph {
|
||||
graph::ConstraintGraph::new(graph::Normal, self, num_region_vars)
|
||||
|
|
@ -63,7 +63,7 @@ impl ConstraintSet {
|
|||
}
|
||||
}
|
||||
|
||||
impl Index<OutlivesConstraintIndex> for ConstraintSet {
|
||||
impl Index<OutlivesConstraintIndex> for OutlivesConstraintSet {
|
||||
type Output = OutlivesConstraint;
|
||||
|
||||
fn index(&self, i: OutlivesConstraintIndex) -> &Self::Output {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
use super::universal_regions::UniversalRegions;
|
||||
use crate::borrow_check::nll::constraints::graph::NormalConstraintGraph;
|
||||
use crate::borrow_check::nll::constraints::{ConstraintSccIndex, ConstraintSet, OutlivesConstraint};
|
||||
use crate::borrow_check::nll::constraints::{ConstraintSccIndex, OutlivesConstraintSet, OutlivesConstraint};
|
||||
use crate::borrow_check::nll::region_infer::values::{
|
||||
PlaceholderIndices, RegionElement, ToElementIndex
|
||||
};
|
||||
|
|
@ -49,7 +49,7 @@ pub struct RegionInferenceContext<'tcx> {
|
|||
liveness_constraints: LivenessValues<RegionVid>,
|
||||
|
||||
/// The outlives constraints computed by the type-check.
|
||||
constraints: Rc<ConstraintSet>,
|
||||
constraints: Rc<OutlivesConstraintSet>,
|
||||
|
||||
/// The constraint-set, but in graph form, making it easy to traverse
|
||||
/// the constraints adjacent to a particular region. Used to construct
|
||||
|
|
@ -186,7 +186,7 @@ impl<'tcx> RegionInferenceContext<'tcx> {
|
|||
placeholder_indices: Rc<PlaceholderIndices>,
|
||||
universal_region_relations: Rc<UniversalRegionRelations<'tcx>>,
|
||||
_body: &Body<'tcx>,
|
||||
outlives_constraints: ConstraintSet,
|
||||
outlives_constraints: OutlivesConstraintSet,
|
||||
closure_bounds_mapping: FxHashMap<
|
||||
Location,
|
||||
FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
use crate::borrow_check::location::LocationTable;
|
||||
use crate::borrow_check::nll::constraints::ConstraintSet;
|
||||
use crate::borrow_check::nll::constraints::OutlivesConstraintSet;
|
||||
use crate::borrow_check::nll::facts::{AllFacts, AllFactsExt};
|
||||
use crate::borrow_check::nll::region_infer::values::RegionValueElements;
|
||||
use crate::borrow_check::nll::universal_regions::UniversalRegions;
|
||||
|
|
@ -107,7 +107,7 @@ fn compute_live_locals(
|
|||
fn regions_that_outlive_free_regions(
|
||||
num_region_vars: usize,
|
||||
universal_regions: &UniversalRegions<'tcx>,
|
||||
constraint_set: &ConstraintSet,
|
||||
constraint_set: &OutlivesConstraintSet,
|
||||
) -> FxHashSet<RegionVid> {
|
||||
// Build a graph of the outlives constraints thus far. This is
|
||||
// a reverse graph, so for each constraint `R1: R2` we have an
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use crate::borrow_check::borrow_set::BorrowSet;
|
||||
use crate::borrow_check::location::LocationTable;
|
||||
use crate::borrow_check::nll::constraints::{ConstraintSet, OutlivesConstraint};
|
||||
use crate::borrow_check::nll::constraints::{OutlivesConstraintSet, OutlivesConstraint};
|
||||
use crate::borrow_check::nll::facts::AllFacts;
|
||||
use crate::borrow_check::nll::region_infer::values::LivenessValues;
|
||||
use crate::borrow_check::nll::region_infer::values::PlaceholderIndex;
|
||||
|
|
@ -127,7 +127,7 @@ pub(crate) fn type_check<'tcx>(
|
|||
placeholder_indices: PlaceholderIndices::default(),
|
||||
placeholder_index_to_region: IndexVec::default(),
|
||||
liveness_constraints: LivenessValues::new(elements.clone()),
|
||||
outlives_constraints: ConstraintSet::default(),
|
||||
outlives_constraints: OutlivesConstraintSet::default(),
|
||||
closure_bounds_mapping: Default::default(),
|
||||
type_tests: Vec::default(),
|
||||
};
|
||||
|
|
@ -884,7 +884,7 @@ crate struct MirTypeckRegionConstraints<'tcx> {
|
|||
/// hence it must report on their liveness constraints.
|
||||
crate liveness_constraints: LivenessValues<RegionVid>,
|
||||
|
||||
crate outlives_constraints: ConstraintSet,
|
||||
crate outlives_constraints: OutlivesConstraintSet,
|
||||
|
||||
crate closure_bounds_mapping:
|
||||
FxHashMap<Location, FxHashMap<(RegionVid, RegionVid), (ConstraintCategory, Span)>>,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue