Skip to content

Commit 0df1e57

Browse files
committed
Auto merge of rust-lang#60244 - SimonSapin:dangling, r=oli-obk
const-stabilize NonNull::dangling and NonNull::cast
2 parents efa3c27 + 885a001 commit 0df1e57

File tree

2 files changed

+0
-4
lines changed

2 files changed

+0
-4
lines changed

src/libcore/ptr.rs

-2
Original file line numberDiff line numberDiff line change
@@ -2970,7 +2970,6 @@ impl<T: Sized> NonNull<T> {
29702970
/// some other means.
29712971
#[stable(feature = "nonnull", since = "1.25.0")]
29722972
#[inline]
2973-
#[rustc_const_unstable(feature = "const_ptr_nonnull")]
29742973
pub const fn dangling() -> Self {
29752974
unsafe {
29762975
let ptr = mem::align_of::<T>() as *mut T;
@@ -3034,7 +3033,6 @@ impl<T: ?Sized> NonNull<T> {
30343033
/// Cast to a pointer of another type
30353034
#[stable(feature = "nonnull_cast", since = "1.27.0")]
30363035
#[inline]
3037-
#[rustc_const_unstable(feature = "const_ptr_nonnull")]
30383036
pub const fn cast<U>(self) -> NonNull<U> {
30393037
unsafe {
30403038
NonNull::new_unchecked(self.as_ptr() as *mut U)

src/test/run-pass/consts/const-ptr-nonnull.rs

-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
// run-pass
22

3-
#![feature(const_ptr_nonnull)]
4-
53
use std::ptr::NonNull;
64

75
const DANGLING: NonNull<u32> = NonNull::dangling();

0 commit comments

Comments
 (0)