diff --git a/compiler/rustc_data_structures/src/sync.rs b/compiler/rustc_data_structures/src/sync.rs index 96dc187611d..25a08237346 100644 --- a/compiler/rustc_data_structures/src/sync.rs +++ b/compiler/rustc_data_structures/src/sync.rs @@ -139,14 +139,14 @@ cfg_if! { impl Atomic { pub fn fetch_or(&self, val: bool, _: Ordering) -> bool { - let result = self.0.get() | val; - self.0.set(val); - result + let old = self.0.get(); + self.0.set(val | old); + old } pub fn fetch_and(&self, val: bool, _: Ordering) -> bool { - let result = self.0.get() & val; - self.0.set(val); - result + let old = self.0.get(); + self.0.set(val & old); + old } }