1
Fork 0

stabilize const_nonnull_new

This commit is contained in:
Ralf Jung 2024-12-10 11:29:01 +01:00
parent ff7906bfe1
commit a8d11ea20e
3 changed files with 1 additions and 4 deletions

View file

@ -217,7 +217,7 @@ impl<T: ?Sized> NonNull<T> {
/// }
/// ```
#[stable(feature = "nonnull", since = "1.25.0")]
#[rustc_const_unstable(feature = "const_nonnull_new", issue = "93235")]
#[rustc_const_stable(feature = "const_nonnull_new", since = "CURRENT_RUSTC_VERSION")]
#[inline]
pub const fn new(ptr: *mut T) -> Option<Self> {
if !ptr.is_null() {

View file

@ -92,8 +92,6 @@ impl<T: ?Sized> Unique<T> {
/// Creates a new `Unique` if `ptr` is non-null.
#[inline]
// rustc_const_unstable attribute can be removed when `const_nonnull_new` is stable
#[rustc_const_unstable(feature = "ptr_internals", issue = "none")]
pub const fn new(ptr: *mut T) -> Option<Self> {
if let Some(pointer) = NonNull::new(ptr) {
Some(Unique { pointer, _marker: PhantomData })

View file

@ -15,7 +15,6 @@
#![feature(clone_to_uninit)]
#![feature(const_black_box)]
#![feature(const_eval_select)]
#![feature(const_nonnull_new)]
#![feature(const_swap)]
#![feature(const_trait_impl)]
#![feature(core_intrinsics)]