diff options
| author | Michael Howell <michael@notriddle.com> | 2023-05-25 15:18:05 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-05-25 15:18:05 -0700 |
| commit | 52bd82f522c4f3d9bd0dc534c06169285afbc23b (patch) | |
| tree | cc77bce7101e8c6715ee5e9c44e4c9a9adaf3235 /compiler/rustc_data_structures/src | |
| parent | 64cfc212890515fe4c41374acbc986034450d3b7 (diff) | |
| download | rust-52bd82f522c4f3d9bd0dc534c06169285afbc23b.tar.gz rust-52bd82f522c4f3d9bd0dc534c06169285afbc23b.zip | |
rustc_data_structures: sync and atomic consistency
Co-authored-by: @lukas-code
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/sync.rs | 12 |
1 files changed, 6 insertions, 6 deletions
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<bool> { 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 } } |
