From 6a358960da438efca794020bf5497b41ce3ffe17 Mon Sep 17 00:00:00 2001 From: Michael Howell Date: Tue, 9 May 2023 13:46:54 -0700 Subject: rustc_metadata: specialize private_dep flag with `fetch_and` --- compiler/rustc_data_structures/src/sync.rs | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-) (limited to 'compiler/rustc_data_structures') 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, - ) -> Result { - 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 } } -- cgit 1.4.1-3-g733a5