about summary refs log tree commit diff
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2018-07-02 11:40:49 -0400
committerNiko Matsakis <niko@alum.mit.edu>2018-07-02 11:40:49 -0400
commit78ea95258d6e3f603713ffde001334305044a4fb (patch)
treeddf1e113feaecc1d5031f19a8ba993868671583d
parent73f8333e78e277353a1b69fbf605b9956a6c8ae5 (diff)
downloadrust-78ea95258d6e3f603713ffde001334305044a4fb.tar.gz
rust-78ea95258d6e3f603713ffde001334305044a4fb.zip
improve comments
-rw-r--r--src/librustc_data_structures/indexed_set.rs6
-rw-r--r--src/librustc_mir/util/liveness.rs5
2 files changed, 10 insertions, 1 deletions
diff --git a/src/librustc_data_structures/indexed_set.rs b/src/librustc_data_structures/indexed_set.rs
index 30b87c0390a..2e95a45479c 100644
--- a/src/librustc_data_structures/indexed_set.rs
+++ b/src/librustc_data_structures/indexed_set.rs
@@ -239,14 +239,20 @@ impl<T: Idx> IdxSet<T> {
         self.words_mut().clone_from_slice(other.words());
     }
 
+    /// Set `self = self | other` and return true if `self` changed
+    /// (i.e., if new bits were added).
     pub fn union(&mut self, other: &IdxSet<T>) -> bool {
         bitwise(self.words_mut(), other.words(), &Union)
     }
 
+    /// Set `self = self - other` and return true if `self` changed.
+    /// (i.e., if any bits were removed).
     pub fn subtract(&mut self, other: &IdxSet<T>) -> bool {
         bitwise(self.words_mut(), other.words(), &Subtract)
     }
 
+    /// Set `self = self & other` and return true if `self` changed.
+    /// (i.e., if any bits were removed).
     pub fn intersect(&mut self, other: &IdxSet<T>) -> bool {
         bitwise(self.words_mut(), other.words(), &Intersect)
     }
diff --git a/src/librustc_mir/util/liveness.rs b/src/librustc_mir/util/liveness.rs
index d4b93b896de..4630cdae47d 100644
--- a/src/librustc_mir/util/liveness.rs
+++ b/src/librustc_mir/util/liveness.rs
@@ -140,9 +140,12 @@ pub fn liveness_of_locals<'tcx>(mir: &Mir<'tcx>, mode: LivenessMode) -> Liveness
         bits.overwrite(&outs[bb]);
         def_use[bb].apply(&mut bits);
 
-        // add `bits` to the out set for each predecessor; if those
+        // `bits` now contains the live variables on entry. Therefore,
+        // add `bits` to the `out` set for each predecessor; if those
         // bits were not already present, then enqueue the predecessor
         // as dirty.
+        //
+        // (note that `union` returns true if the `self` set changed)
         for &pred_bb in &predecessors[bb] {
             if outs[pred_bb].union(&bits) {
                 dirty_queue.insert(pred_bb);