about summary refs log tree commit diff
path: root/src/librustc_data_structures
diff options
context:
space:
mode:
Diffstat (limited to 'src/librustc_data_structures')
-rw-r--r--src/librustc_data_structures/bitvec.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/librustc_data_structures/bitvec.rs b/src/librustc_data_structures/bitvec.rs
index f26307fd8c5..70f50b4c042 100644
--- a/src/librustc_data_structures/bitvec.rs
+++ b/src/librustc_data_structures/bitvec.rs
@@ -24,12 +24,14 @@ impl BitVector {
         (self.data[word] & mask) != 0
     }
 
+    /// Returns true if the bit has changed.
     pub fn insert(&mut self, bit: usize) -> bool {
         let (word, mask) = word_mask(bit);
         let data = &mut self.data[word];
         let value = *data;
-        *data = value | mask;
-        (value | mask) != value
+        let new_value = value | mask;
+        *data = new_value;
+        new_value != value
     }
 
     pub fn insert_all(&mut self, all: &BitVector) -> bool {