Skip to content

Commit 6e0cefe

Browse files
committed
add comments
1 parent ad71cbf commit 6e0cefe

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/librustc_mir/borrow_check/nll/constraint_set.rs

+9
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ impl ConstraintSet {
3838
}
3939
}
4040

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

@@ -51,6 +55,11 @@ impl ConstraintSet {
5155
map
5256
}
5357

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

0 commit comments

Comments
 (0)