Skip to content

Commit

Permalink
Remove redundant nightly feature for fetch_min, fetch_max and fetch…
Browse files Browse the repository at this point in the history
…_update

See also rust-lang/rust#48655 (comment)
  • Loading branch information
tindzk committed Sep 14, 2023
1 parent ce5148e commit 2693e2c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
18 changes: 6 additions & 12 deletions src/lib.rs
Original file line number Diff line number Diff line change
@@ -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};
Expand Down Expand Up @@ -64,18 +64,15 @@ pub trait AtomicInt : Default + Send + Sync + RefUnwindSafe + UnwindSafe {
ordering: Ordering
) -> <Self as AtomicInt>::Prim;

#[cfg(feature="nightly")]
fn fetch_min(&self, val: <Self as AtomicInt>::Prim, order: Ordering) -> <Self as AtomicInt>::Prim;

#[cfg(feature="nightly")]
fn fetch_max(&self, val: <Self as AtomicInt>::Prim, order: Ordering) -> <Self as AtomicInt>::Prim;

#[cfg(feature="nightly")]
fn fetch_update<F>(
&self,
f: F,
set_order: Ordering,
fetch_order: Ordering,
set_order: Ordering
f: F
) -> Result<<Self as AtomicInt>::Prim, <Self as AtomicInt>::Prim>
where F: FnMut(<Self as AtomicInt>::Prim) -> Option<<Self as AtomicInt>::Prim>;

Expand Down Expand Up @@ -173,7 +170,6 @@ macro_rules! impl_atomic_int {
self.fetch_xor(new, ordering)
}

#[cfg(feature = "nightly")]
fn fetch_min(
&self,
val: $prim,
Expand All @@ -182,7 +178,6 @@ macro_rules! impl_atomic_int {
self.fetch_min(val, ordering)
}

#[cfg(feature = "nightly")]
fn fetch_max(
&self,
val: $prim,
Expand All @@ -191,17 +186,16 @@ macro_rules! impl_atomic_int {
self.fetch_max(val, ordering)
}

#[cfg(feature = "nightly")]
fn fetch_update<F>(
&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 {
Expand Down

0 comments on commit 2693e2c

Please sign in to comment.