#[cfg(not(all(test, loom)))]
pub(crate) use core::sync::atomic::{AtomicU8, Ordering};
#[cfg(all(test, loom))]
pub(crate) use loom::{
cell::UnsafeCell,
sync::atomic::{AtomicU8, Ordering},
};
#[cfg(not(all(test, loom)))]
pub(crate) use shim::UnsafeCell;
#[cfg(not(all(test, loom)))]
mod shim {
#[derive(Debug)]
pub(crate) struct UnsafeCell<T>(core::cell::UnsafeCell<T>);
impl<T> UnsafeCell<T> {
pub(crate) const fn new(data: T) -> UnsafeCell<T> {
UnsafeCell(core::cell::UnsafeCell::new(data))
}
#[inline(always)]
pub(crate) fn with<R>(&self, f: impl FnOnce(*const T) -> R) -> R {
f(self.0.get())
}
#[inline(always)]
pub(crate) fn with_mut<R>(&self, f: impl FnOnce(*mut T) -> R) -> R {
f(self.0.get())
}
pub(crate) fn into_inner(self) -> T {
self.0.into_inner()
}
}
}