about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/librustc_mir/borrow_check/nll/constraints/graph.rs12
-rw-r--r--src/librustc_mir/borrow_check/nll/constraints/mod.rs16
2 files changed, 16 insertions, 12 deletions
diff --git a/src/librustc_mir/borrow_check/nll/constraints/graph.rs b/src/librustc_mir/borrow_check/nll/constraints/graph.rs
index c4b2a5daef8..78d49309d02 100644
--- a/src/librustc_mir/borrow_check/nll/constraints/graph.rs
+++ b/src/librustc_mir/borrow_check/nll/constraints/graph.rs
@@ -1,5 +1,5 @@
 use crate::borrow_check::nll::type_check::Locations;
-use crate::borrow_check::nll::constraints::ConstraintIndex;
+use crate::borrow_check::nll::constraints::OutlivesConstraintIndex;
 use crate::borrow_check::nll::constraints::{ConstraintSet, OutlivesConstraint};
 use rustc::mir::ConstraintCategory;
 use rustc::ty::RegionVid;
@@ -12,8 +12,8 @@ use syntax_pos::DUMMY_SP;
 /// -> R2` or `R2 -> R1` depending on the direction type `D`.
 crate struct ConstraintGraph<D: ConstraintGraphDirecton> {
     _direction: D,
-    first_constraints: IndexVec<RegionVid, Option<ConstraintIndex>>,
-    next_constraints: IndexVec<ConstraintIndex, Option<ConstraintIndex>>,
+    first_constraints: IndexVec<RegionVid, Option<OutlivesConstraintIndex>>,
+    next_constraints: IndexVec<OutlivesConstraintIndex, Option<OutlivesConstraintIndex>>,
 }
 
 crate type NormalConstraintGraph = ConstraintGraph<Normal>;
@@ -81,9 +81,9 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
         num_region_vars: usize,
     ) -> Self {
         let mut first_constraints = IndexVec::from_elem_n(None, num_region_vars);
-        let mut next_constraints = IndexVec::from_elem(None, &set.constraints);
+        let mut next_constraints = IndexVec::from_elem(None, &set.outlives);
 
-        for (idx, constraint) in set.constraints.iter_enumerated().rev() {
+        for (idx, constraint) in set.outlives.iter_enumerated().rev() {
             let head = &mut first_constraints[D::start_region(constraint)];
             let next = &mut next_constraints[idx];
             debug_assert!(next.is_none());
@@ -143,7 +143,7 @@ impl<D: ConstraintGraphDirecton> ConstraintGraph<D> {
 crate struct Edges<'s, D: ConstraintGraphDirecton> {
     graph: &'s ConstraintGraph<D>,
     constraints: &'s ConstraintSet,
-    pointer: Option<ConstraintIndex>,
+    pointer: Option<OutlivesConstraintIndex>,
     next_static_idx: Option<usize>,
     static_region: RegionVid,
 }
diff --git a/src/librustc_mir/borrow_check/nll/constraints/mod.rs b/src/librustc_mir/borrow_check/nll/constraints/mod.rs
index b1091eb5ac8..a4c66d5ef6e 100644
--- a/src/librustc_mir/borrow_check/nll/constraints/mod.rs
+++ b/src/librustc_mir/borrow_check/nll/constraints/mod.rs
@@ -9,9 +9,13 @@ use std::ops::Deref;
 
 crate mod graph;
 
+/// A set of NLL region constraints. These include "outlives"
+/// constraints of the form `R1: R2`. Each constraint is identified by
+/// a unique `OutlivesConstraintIndex` and you can index into the set
+/// (`constraint_set[i]`) to access the constraint details.
 #[derive(Clone, Default)]
 crate struct ConstraintSet {
-    constraints: IndexVec<ConstraintIndex, OutlivesConstraint>,
+    outlives: IndexVec<OutlivesConstraintIndex, OutlivesConstraint>,
 }
 
 impl ConstraintSet {
@@ -24,7 +28,7 @@ impl ConstraintSet {
             // 'a: 'a is pretty uninteresting
             return;
         }
-        self.constraints.push(constraint);
+        self.outlives.push(constraint);
     }
 
     /// Constructs a "normal" graph from the constraint set; the graph makes it
@@ -57,10 +61,10 @@ impl ConstraintSet {
 }
 
 impl Deref for ConstraintSet {
-    type Target = IndexVec<ConstraintIndex, OutlivesConstraint>;
+    type Target = IndexVec<OutlivesConstraintIndex, OutlivesConstraint>;
 
     fn deref(&self) -> &Self::Target {
-        &self.constraints
+        &self.outlives
     }
 }
 
@@ -94,8 +98,8 @@ impl fmt::Debug for OutlivesConstraint {
 }
 
 newtype_index! {
-    pub struct ConstraintIndex {
-        DEBUG_FORMAT = "ConstraintIndex({})"
+    pub struct OutlivesConstraintIndex {
+        DEBUG_FORMAT = "OutlivesConstraintIndex({})"
     }
 }