Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions library/core/src/ptr/non_null.rs
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ impl<T: PointeeSized> NonNull<T> {
/// use std::ptr::NonNull;
///
/// let mut x = 0u32;
/// let ptr = NonNull::<u32>::new(&mut x as *mut _).expect("ptr is null!");
/// let ptr = NonNull::<u32>::new(&mut x as *mut _).expect("pointer should not be null");
///
/// if let Some(ptr) = NonNull::<u32>::new(std::ptr::null_mut()) {
/// unreachable!();
Expand Down Expand Up @@ -386,7 +386,7 @@ impl<T: PointeeSized> NonNull<T> {
/// use std::ptr::NonNull;
///
/// let mut x = 0u32;
/// let ptr = NonNull::new(&mut x).expect("ptr is null!");
/// let ptr = NonNull::new(&mut x).expect("pointer should not be null");
///
/// let x_value = unsafe { *ptr.as_ptr() };
/// assert_eq!(x_value, 0);
Expand Down Expand Up @@ -428,7 +428,7 @@ impl<T: PointeeSized> NonNull<T> {
/// use std::ptr::NonNull;
///
/// let mut x = 0u32;
/// let ptr = NonNull::new(&mut x as *mut _).expect("ptr is null!");
/// let ptr = NonNull::new(&mut x as *mut _).expect("pointer should not be null");
///
/// let ref_x = unsafe { ptr.as_ref() };
/// println!("{ref_x}");
Expand Down Expand Up @@ -464,7 +464,7 @@ impl<T: PointeeSized> NonNull<T> {
/// use std::ptr::NonNull;
///
/// let mut x = 0u32;
/// let mut ptr = NonNull::new(&mut x).expect("null pointer");
/// let mut ptr = NonNull::new(&mut x).expect("pointer should not be null");
///
/// let x_ref = unsafe { ptr.as_mut() };
/// assert_eq!(*x_ref, 0);
Expand All @@ -491,7 +491,7 @@ impl<T: PointeeSized> NonNull<T> {
/// use std::ptr::NonNull;
///
/// let mut x = 0u32;
/// let ptr = NonNull::new(&mut x as *mut _).expect("null pointer");
/// let ptr = NonNull::new(&mut x as *mut _).expect("pointer should not be null");
///
/// let casted_ptr = ptr.cast::<i8>();
/// let raw_ptr: *mut i8 = casted_ptr.as_ptr();
Expand Down
Loading