From e74aa2bdff5420458f7dddce070e8a00a6dfdfe8 Mon Sep 17 00:00:00 2001 From: Simonas Kazlauskas Date: Thu, 21 Jan 2016 18:57:43 +0200 Subject: [MIR] Promote temps to alloca on multi-assignment Fixes #31002 --- src/librustc_data_structures/bitvec.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/librustc_data_structures/bitvec.rs') 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 { -- cgit 1.4.1-3-g733a5