Skip to content

Commit 52bd82f

Browse files
committed
rustc_data_structures: sync and atomic consistency
Co-authored-by: @lukas-code
1 parent 64cfc21 commit 52bd82f

File tree

1 file changed

+6
-6
lines changed
  • compiler/rustc_data_structures/src

1 file changed

+6
-6
lines changed

compiler/rustc_data_structures/src/sync.rs

+6-6
Original file line numberDiff line numberDiff line change
@@ -139,14 +139,14 @@ cfg_if! {
139139

140140
impl Atomic<bool> {
141141
pub fn fetch_or(&self, val: bool, _: Ordering) -> bool {
142-
let result = self.0.get() | val;
143-
self.0.set(val);
144-
result
142+
let old = self.0.get();
143+
self.0.set(val | old);
144+
old
145145
}
146146
pub fn fetch_and(&self, val: bool, _: Ordering) -> bool {
147-
let result = self.0.get() & val;
148-
self.0.set(val);
149-
result
147+
let old = self.0.get();
148+
self.0.set(val & old);
149+
old
150150
}
151151
}
152152

0 commit comments

Comments
 (0)