Skip to content

Commit 78ea952

Browse files
committed
improve comments
1 parent 73f8333 commit 78ea952

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/librustc_data_structures/indexed_set.rs

+6
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,20 @@ impl<T: Idx> IdxSet<T> {
239239
self.words_mut().clone_from_slice(other.words());
240240
}
241241

242+
/// Set `self = self | other` and return true if `self` changed
243+
/// (i.e., if new bits were added).
242244
pub fn union(&mut self, other: &IdxSet<T>) -> bool {
243245
bitwise(self.words_mut(), other.words(), &Union)
244246
}
245247

248+
/// Set `self = self - other` and return true if `self` changed.
249+
/// (i.e., if any bits were removed).
246250
pub fn subtract(&mut self, other: &IdxSet<T>) -> bool {
247251
bitwise(self.words_mut(), other.words(), &Subtract)
248252
}
249253

254+
/// Set `self = self & other` and return true if `self` changed.
255+
/// (i.e., if any bits were removed).
250256
pub fn intersect(&mut self, other: &IdxSet<T>) -> bool {
251257
bitwise(self.words_mut(), other.words(), &Intersect)
252258
}

src/librustc_mir/util/liveness.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,12 @@ pub fn liveness_of_locals<'tcx>(mir: &Mir<'tcx>, mode: LivenessMode) -> Liveness
140140
bits.overwrite(&outs[bb]);
141141
def_use[bb].apply(&mut bits);
142142

143-
// add `bits` to the out set for each predecessor; if those
143+
// `bits` now contains the live variables on entry. Therefore,
144+
// add `bits` to the `out` set for each predecessor; if those
144145
// bits were not already present, then enqueue the predecessor
145146
// as dirty.
147+
//
148+
// (note that `union` returns true if the `self` set changed)
146149
for &pred_bb in &predecessors[bb] {
147150
if outs[pred_bb].union(&bits) {
148151
dirty_queue.insert(pred_bb);

0 commit comments

Comments
 (0)