diff options
| author | Michael Howell <michael@notriddle.com> | 2023-05-09 13:46:54 -0700 |
|---|---|---|
| committer | Michael Howell <michael@notriddle.com> | 2023-05-25 08:15:05 -0700 |
| commit | 6a358960da438efca794020bf5497b41ce3ffe17 (patch) | |
| tree | 0b6fd5c2a87ba3b993e5f83b2356b38e0d963d28 /compiler/rustc_data_structures/src/sync.rs | |
| parent | bd90868b3f7458fa00dbd6b12927153f28556467 (diff) | |
| download | rust-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.rs | 17 |
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 } } |
