Skip to content

Commit 5e5a057

Browse files
committed
Remove nightly Cargo feature
All required unstable features have been stable since Rust version 1.46.0.
1 parent 37523c1 commit 5e5a057

File tree

2 files changed

+21
-50
lines changed

2 files changed

+21
-50
lines changed

Cargo.toml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,4 @@ readme = "README.md"
1010
license = "MIT"
1111
keywords = ["atomic", "reference", "static"]
1212

13-
[features]
14-
default = []
15-
nightly = []
16-
1713
[dependencies]

src/lib.rs

Lines changed: 21 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,8 @@
7171
//! assert!(res);
7272
//! }
7373
//! ```
74-
//!
75-
//! # Cargo Features
76-
//!
77-
//! - `nightly` enables the use of unstable features. Turns [`AtomicRef::new`]
78-
//! into `const fn`, making it callable in constant contexts.
79-
//!
8074
#![no_std]
81-
#![cfg_attr(feature = "nightly", feature(const_if_match))]
75+
8276

8377
use core::sync::atomic::{AtomicPtr, Ordering};
8478
use core::marker::PhantomData;
@@ -183,29 +177,12 @@ macro_rules! static_atomic_ref {
183177
() => ();
184178
}
185179

186-
macro_rules! const_fn_if_nightly {
187-
(
188-
$( #[$meta:meta] )*
189-
$vis:vis fn $($rest:tt)*
190-
) => {
191-
$( #[$meta] )*
192-
#[cfg(feature = "nightly")]
193-
$vis const fn $($rest)*
194-
195-
$( #[$meta] )*
196-
#[cfg(not(feature = "nightly"))]
197-
$vis fn $($rest)*
198-
};
199-
}
200-
201-
const_fn_if_nightly! {
202-
/// An internal helper function for converting `Option<&'a T>` values to
203-
/// `*mut T` for storing in the `AtomicUsize`.
204-
fn from_opt<'a, T>(p: Option<&'a T>) -> *mut T {
205-
match p {
206-
Some(p) => p as *const T as *mut T,
207-
None => null_mut(),
208-
}
180+
/// An internal helper function for converting `Option<&'a T>` values to
181+
/// `*mut T` for storing in the `AtomicUsize`.
182+
const fn from_opt<'a, T>(p: Option<&'a T>) -> *mut T {
183+
match p {
184+
Some(p) => p as *const T as *mut T,
185+
None => null_mut(),
209186
}
210187
}
211188

@@ -216,22 +193,20 @@ unsafe fn to_opt<'a, T>(p: *mut T) -> Option<&'a T> {
216193
}
217194

218195
impl<'a, T> AtomicRef<'a, T> {
219-
const_fn_if_nightly! {
220-
/// Creates a new `AtomicRef`.
221-
///
222-
/// # Examples
223-
///
224-
/// ```
225-
/// use atomic_ref::AtomicRef;
226-
///
227-
/// static VALUE: i32 = 10;
228-
/// let atomic_ref = AtomicRef::new(Some(&VALUE));
229-
/// ```
230-
pub fn new(p: Option<&'a T>) -> AtomicRef<'a, T> {
231-
AtomicRef {
232-
data: AtomicPtr::new(from_opt(p)),
233-
_marker: PhantomData,
234-
}
196+
/// Creates a new `AtomicRef`.
197+
///
198+
/// # Examples
199+
///
200+
/// ```
201+
/// use atomic_ref::AtomicRef;
202+
///
203+
/// static VALUE: i32 = 10;
204+
/// let atomic_ref = AtomicRef::new(Some(&VALUE));
205+
/// ```
206+
pub const fn new(p: Option<&'a T>) -> AtomicRef<'a, T> {
207+
AtomicRef {
208+
data: AtomicPtr::new(from_opt(p)),
209+
_marker: PhantomData,
235210
}
236211
}
237212

0 commit comments

Comments
 (0)