-
Notifications
You must be signed in to change notification settings - Fork 3
Make AtomicRef::new
const fn
#2
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Conversation
Raises the minimum supported Rust version to 1.32.0.
Requires the following unstable features: - `const_fn` for constructing `PhantomData<&mut _>` <rust-lang/rust#57563> - `const_if_match` for using `match` in a user-defined `const fn` <rust-lang/rust#49146>
This feature is on-route to being stabilized in the near future (rust-lang/rust#72437). It might be nice to avoid the nightly feature here by waiting for that feature to be stabilized first, and releasing a If you need const constructors right now, it might be easier to add: const fn null() -> Self {
AtomicRef {
data: AtomicPtr::new(ptr::null_mut()),
_marker: PhantomData,
}
}
const fn from(r: &'a T) -> Self {
AtomicRef {
data: AtomicPtr::new(r as *const T as *mut T),
_marker: PhantomData,
}
} |
All required unstable features have been stable since Rust version 1.46.0.
I added commits that got rid of |
AtomicRef::new
const fn
(nightly-only)AtomicRef::new
const fn
These reexports are no longer necessary since we removed the `static_atomic_ref` macro in 7b6f17e.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Turns
AtomicRef::new
intoconst fn
, making it callable in constant contexts.This currently requires the use of a nightly-only feature, so it's feature-gated by the Cargo featurenightly
. This can be removed in the future when this unstable feature is stabilized.Raises the minimum supported Rust version to 1.32.0 (regardless of thenightly
feature).As of 5e5a057, this PR raises the minimum supported Rust version to 1.46.0.
This PR depends on #1.