Skip to content
Permalink
Browse files

const-stabilize NonNull::dangling and NonNull::cast

  • Loading branch information...
SimonSapin committed Apr 24, 2019
1 parent e305df1 commit 885a001788d18dbbde14587e1dbccca0dad73776
Showing with 0 additions and 4 deletions.
  1. +0 −2 src/libcore/ptr.rs
  2. +0 −2 src/test/run-pass/consts/const-ptr-nonnull.rs
@@ -2959,7 +2959,6 @@ impl<T: Sized> NonNull<T> {
/// some other means.
#[stable(feature = "nonnull", since = "1.25.0")]
#[inline]
#[rustc_const_unstable(feature = "const_ptr_nonnull")]
pub const fn dangling() -> Self {
unsafe {
let ptr = mem::align_of::<T>() as *mut T;
@@ -3023,7 +3022,6 @@ impl<T: ?Sized> NonNull<T> {
/// Cast to a pointer of another type
#[stable(feature = "nonnull_cast", since = "1.27.0")]
#[inline]
#[rustc_const_unstable(feature = "const_ptr_nonnull")]
pub const fn cast<U>(self) -> NonNull<U> {
unsafe {
NonNull::new_unchecked(self.as_ptr() as *mut U)
@@ -1,7 +1,5 @@
// run-pass

#![feature(const_ptr_nonnull)]

use std::ptr::NonNull;

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

0 comments on commit 885a001

Please sign in to comment.
You can’t perform that action at this time.