From a8d11ea20e282c7e63a965df7a30ab840ea049eb Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Tue, 10 Dec 2024 11:29:01 +0100 Subject: [PATCH] stabilize const_nonnull_new --- library/core/src/ptr/non_null.rs | 2 +- library/core/src/ptr/unique.rs | 2 -- library/core/tests/lib.rs | 1 - 3 files changed, 1 insertion(+), 4 deletions(-) diff --git a/library/core/src/ptr/non_null.rs b/library/core/src/ptr/non_null.rs index 0ad1cad6914ad..6b601405e1c2a 100644 --- a/library/core/src/ptr/non_null.rs +++ b/library/core/src/ptr/non_null.rs @@ -217,7 +217,7 @@ impl NonNull { /// } /// ``` #[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 { if !ptr.is_null() { diff --git a/library/core/src/ptr/unique.rs b/library/core/src/ptr/unique.rs index ebdc918a729c7..4810ebe01f9bb 100644 --- a/library/core/src/ptr/unique.rs +++ b/library/core/src/ptr/unique.rs @@ -92,8 +92,6 @@ impl Unique { /// 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 { if let Some(pointer) = NonNull::new(ptr) { Some(Unique { pointer, _marker: PhantomData }) diff --git a/library/core/tests/lib.rs b/library/core/tests/lib.rs index a4a794691fe38..89b65eefd027e 100644 --- a/library/core/tests/lib.rs +++ b/library/core/tests/lib.rs @@ -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)]