about summary refs log tree commit diff
path: root/compiler/rustc_data_structures
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2023-06-02 10:03:49 +0200
committerRalf Jung <post@ralfj.de>2023-06-02 10:03:49 +0200
commitc5aebfb9348277639b0877eb83995dfd1bd2ff23 (patch)
treed54ef5d9706906a3b6bd2aa5337bd32d03b4112e /compiler/rustc_data_structures
parent777db72b08f316345cffde2fc83478668b9da7cf (diff)
parent33c3d101280c8eb3cd8af421bfb56a8afcc3881d (diff)
downloadrust-c5aebfb9348277639b0877eb83995dfd1bd2ff23.tar.gz
rust-c5aebfb9348277639b0877eb83995dfd1bd2ff23.zip
Merge from rustc
Diffstat (limited to 'compiler/rustc_data_structures')
-rw-r--r--compiler/rustc_data_structures/src/sync.rs11
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
             }
         }