about summary refs log tree commit diff
path: root/compiler/rustc_data_structures/src/sync.rs
diff options
context:
space:
mode:
authorMichael Howell <michael@notriddle.com>2023-05-09 13:46:54 -0700
committerMichael Howell <michael@notriddle.com>2023-05-25 08:15:05 -0700
commit6a358960da438efca794020bf5497b41ce3ffe17 (patch)
tree0b6fd5c2a87ba3b993e5f83b2356b38e0d963d28 /compiler/rustc_data_structures/src/sync.rs
parentbd90868b3f7458fa00dbd6b12927153f28556467 (diff)
downloadrust-6a358960da438efca794020bf5497b41ce3ffe17.tar.gz
rust-6a358960da438efca794020bf5497b41ce3ffe17.zip
rustc_metadata: specialize private_dep flag with `fetch_and`
Diffstat (limited to 'compiler/rustc_data_structures/src/sync.rs')
-rw-r--r--compiler/rustc_data_structures/src/sync.rs17
1 files changed, 4 insertions, 13 deletions
diff --git a/compiler/rustc_data_structures/src/sync.rs b/compiler/rustc_data_structures/src/sync.rs
index df8285cc729..96dc187611d 100644
--- a/compiler/rustc_data_structures/src/sync.rs
+++ b/compiler/rustc_data_structures/src/sync.rs
@@ -143,19 +143,10 @@ cfg_if! {
                 self.0.set(val);
                 result
             }
-            pub fn fetch_update(
-                &self,
-                _order_set: Ordering,
-                _order_get: Ordering,
-                mut f: impl FnMut(bool) -> Option<bool>,
-            ) -> Result<bool, bool> {
-                let prev = self.0.get();
-                if let Some(next) = f(prev) {
-                    self.0.set(next);
-                    Ok(prev)
-                } else {
-                    Err(prev)
-                }
+            pub fn fetch_and(&self, val: bool, _: Ordering) -> bool {
+                let result = self.0.get() & val;
+                self.0.set(val);
+                result
             }
         }