diff --git a/README.md b/README.md index 0be8db5..253ae8b 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ Traits over atomic primitive integer types. ## Notes -* Enable feature `nightly` to get `min`, `max`, `fetch_update` and - `as_mut_ptr` when you have a nightly compiler available. +* Enable feature `nightly` to get `as_mut_ptr` when you have a nightly compiler available. +* Rust 1.45.0 or newer is required ## Copyright and License diff --git a/src/lib.rs b/src/lib.rs index 503e9ff..84b04a5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,4 +1,4 @@ -#![cfg_attr(feature = "nightly", feature(atomic_min_max, atomic_mut_ptr, no_more_cas))] +#![cfg_attr(feature = "nightly", feature(atomic_mut_ptr))] use std::sync::atomic::{self, Ordering}; use std::hash::Hash; use std::fmt::{Debug, Display}; @@ -64,18 +64,15 @@ pub trait AtomicInt : Default + Send + Sync + RefUnwindSafe + UnwindSafe { ordering: Ordering ) -> ::Prim; - #[cfg(feature="nightly")] fn fetch_min(&self, val: ::Prim, order: Ordering) -> ::Prim; - #[cfg(feature="nightly")] fn fetch_max(&self, val: ::Prim, order: Ordering) -> ::Prim; - #[cfg(feature="nightly")] fn fetch_update( &self, - f: F, + set_order: Ordering, fetch_order: Ordering, - set_order: Ordering + f: F ) -> Result<::Prim, ::Prim> where F: FnMut(::Prim) -> Option<::Prim>; @@ -173,7 +170,6 @@ macro_rules! impl_atomic_int { self.fetch_xor(new, ordering) } - #[cfg(feature = "nightly")] fn fetch_min( &self, val: $prim, @@ -182,7 +178,6 @@ macro_rules! impl_atomic_int { self.fetch_min(val, ordering) } - #[cfg(feature = "nightly")] fn fetch_max( &self, val: $prim, @@ -191,17 +186,16 @@ macro_rules! impl_atomic_int { self.fetch_max(val, ordering) } - #[cfg(feature = "nightly")] fn fetch_update( &self, - f: F, - fetch_order: Ordering, set_order: Ordering, + fetch_order: Ordering, + mut f: F, ) -> Result<$prim, $prim> where F: FnMut($prim) -> Option<$prim>, { - self.fetch_update(f, fetch_order, set_order) + self.fetch_update(set_order, fetch_order, f) } fn get_mut(&mut self) -> &mut $prim {