This is a tracking issue for atomic operations in const.
// core::sync::atomic
impl AtomicBool {
pub const fn get_mut(&mut self) -> &mut bool;
pub const fn from_mut(v: &mut bool) -> &mut Self;
pub const fn get_mut_slice(this: &mut [Self]) -> &mut [bool];
pub const fn from_mut_slice(v: &mut [bool]) -> &mut [Self];
pub const fn load(&self, order: Ordering) -> bool;
pub const fn store(&self, val: bool, order: Ordering);
pub const fn swap(&self, val: bool, order: Ordering) -> bool;
pub const fn compare_and_swap(&self, current: bool, new: bool, order: Ordering) -> bool;
pub const fn compare_exchange(
&self,
current: bool,
new: bool,
success: Ordering,
failure: Ordering,
) -> Result<bool, bool>;
pub const fn compare_exchange_weak(
&self,
current: bool,
new: bool,
success: Ordering,
failure: Ordering,
) -> Result<bool, bool>;
pub const fn fetch_and(&self, val: bool, order: Ordering) -> bool;
pub const fn fetch_nand(&self, val: bool, order: Ordering) -> bool;
pub const fn fetch_or(&self, val: bool, order: Ordering) -> bool;
pub const fn fetch_xor(&self, val: bool, order: Ordering) -> bool;
pub const fn fetch_not(&self, order: Ordering) -> bool;
}
impl AtomicPtr<T> {
pub const fn get_mut(&mut self) -> &mut *mut T;
pub const fn from_mut(v: &mut *mut T) -> &mut Self;
pub const fn get_mut_slice(this: &mut [Self]) -> &mut [*mut T];
pub const fn from_mut_slice(v: &mut [*mut T]) -> &mut [Self];
pub const fn load(&self, order: Ordering) -> *mut T;
pub const fn store(&self, ptr: *mut T, order: Ordering);
pub const fn swap(&self, ptr: *mut T, order: Ordering) -> *mut T;
}
impl Atomic$Int {
pub const fn get_mut(&mut self) -> &mut $int_type;
pub const fn from_mut(v: &mut $int_type) -> &mut Self;
pub const fn get_mut_slice(this: &mut [Self]) -> &mut [$int_type];
pub const fn from_mut_slice(v: &mut [$int_type]) -> &mut [Self];
pub const fn load(&self, order: Ordering) -> $int_type;
pub const fn store(&self, val: $int_type, order: Ordering);
pub const fn swap(&self, val: $int_type, order: Ordering) -> $int_type;
pub const fn compare_and_swap(&self,
current: $int_type,
new: $int_type,
order: Ordering) -> $int_type;
pub const fn compare_exchange(&self,
current: $int_type,
new: $int_type,
success: Ordering,
failure: Ordering) -> Result<$int_type, $int_type>;
pub const fn compare_exchange_weak(&self,
current: $int_type,
new: $int_type,
success: Ordering,
failure: Ordering) -> Result<$int_type, $int_type>;
pub const fn fetch_add(&self, val: $int_type, order: Ordering) -> $int_type;
pub const fn fetch_sub(&self, val: $int_type, order: Ordering) -> $int_type;
pub const fn fetch_and(&self, val: $int_type, order: Ordering) -> $int_type;
pub const fn fetch_nand(&self, val: $int_type, order: Ordering) -> $int_type;
pub const fn fetch_or(&self, val: $int_type, order: Ordering) -> $int_type;
pub const fn fetch_xor(&self, val: $int_type, order: Ordering) -> $int_type;
pub const fn fetch_max(&self, val: $int_type, order: Ordering) -> $int_type;
pub const fn fetch_min(&self, val: $int_type, order: Ordering) -> $int_type;
}
pub const fn fence(order: Ordering);
pub const fn compiler_fence(order: Ordering);
Feature gate:
#![feature(const_atomic)]This is a tracking issue for atomic operations in const.
Public API
Steps / History
(Remember to update the
S-tracking-*label when checking boxes.)Unresolved Questions
compare_and_swapare deprecated. Should we still make themconst fn? Seems odd to make everythingconst fnexcept for these.Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩