rustc_metadata: specialize private_dep flag with fetch_and

This commit is contained in:
Michael Howell 2023-05-09 13:46:54 -07:00
parent bd90868b3f
commit 6a358960da
3 changed files with 7 additions and 19 deletions

View file

@ -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
}
}