Skip to content

Commit

Permalink
Rollup merge of rust-lang#134116 - RalfJung:const_nonnull_new, r=jhpratt
Browse files Browse the repository at this point in the history
stabilize const_nonnull_new

FCP passed in rust-lang#93235

Closes rust-lang#93235
  • Loading branch information
fmease authored Dec 10, 2024
2 parents cf704d1 + a8d11ea commit 386fe81
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 4 deletions.
2 changes: 1 addition & 1 deletion library/core/src/ptr/non_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down
2 changes: 0 additions & 2 deletions library/core/src/ptr/unique.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
Expand Down
1 change: 0 additions & 1 deletion library/core/tests/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)]
Expand Down

0 comments on commit 386fe81

Please sign in to comment.