diff options
| author | bors <bors@rust-lang.org> | 2023-06-02 08:09:48 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2023-06-02 08:09:48 +0000 |
| commit | 507055bc50258f3e2329fb383495f2a6a05a6cd2 (patch) | |
| tree | a1649a1fd2e4663b8c5d239354674a387a855ae5 /compiler/rustc_data_structures/src | |
| parent | 47bf8e734f25e1ed65864263a8795f1335d6dce0 (diff) | |
| parent | be4e05a1906d975ac0e09ca1a5ea2daf6a0018a0 (diff) | |
| download | rust-507055bc50258f3e2329fb383495f2a6a05a6cd2.tar.gz rust-507055bc50258f3e2329fb383495f2a6a05a6cd2.zip | |
Auto merge of #2911 - RalfJung:rustup, r=RalfJung
Rustup
Diffstat (limited to 'compiler/rustc_data_structures/src')
| -rw-r--r-- | compiler/rustc_data_structures/src/sync.rs | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/compiler/rustc_data_structures/src/sync.rs b/compiler/rustc_data_structures/src/sync.rs index 6c3197d8ec2..25a08237346 100644 --- a/compiler/rustc_data_structures/src/sync.rs +++ b/compiler/rustc_data_structures/src/sync.rs @@ -139,9 +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 old = self.0.get(); + self.0.set(val & old); + old } } |
