about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/ptr.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index a07c7260f71..0387708033b 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -2903,7 +2903,7 @@ impl<T: ?Sized> NonNull<T> {
     #[inline]
     pub fn new(ptr: *mut T) -> Option<Self> {
         if !ptr.is_null() {
-            Some(NonNull { pointer: unsafe { NonZero(ptr as _) } })
+            Some(unsafe { Self::new_unchecked(ptr) })
         } else {
             None
         }