Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
Eh2406 committed Jun 28, 2018
1 parent ad71cbf commit 6e0cefe
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/librustc_mir/borrow_check/nll/constraint_set.rs
Expand Up @@ -38,6 +38,10 @@ impl ConstraintSet {
}
}

/// Once all constraints have been added, `link()` is used to thread together the constraints
/// based on which would be affected when a particular region changes. See the next field of
/// `OutlivesContraint` for more details.
/// link returns a map that is needed later by `each_affected_by_dirty`.
pub fn link(&mut self, len: usize) -> IndexVec<RegionVid, Option<ConstraintIndex>> {
let mut map = IndexVec::from_elem_n(None, len);

Expand All @@ -51,6 +55,11 @@ impl ConstraintSet {
map
}

/// When a region R1 changes, we need to reprocess all constraints R2: R1 to take into account
/// any new elements that R1 now has. This method will quickly enumerate all such constraints
/// (that is, constraints where R1 is in the "subregion" position).
/// To use it, invoke with `map[R1]` where map is the map returned by `link`;
/// the callback op will be invoked for each affected constraint.
pub fn each_affected_by_dirty(
&self,
mut opt_dep_idx: Option<ConstraintIndex>,
Expand Down

0 comments on commit 6e0cefe

Please sign in to comment.