Skip to content

Commit 6898d9f

Browse files
Update non_null.rs
1 parent fda97db commit 6898d9f

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

library/core/src/ptr/non_null.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,8 +139,8 @@ impl<T: Sized> NonNull<T> {
139139
#[must_use]
140140
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
141141
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
142-
#[requires(ub_checks::can_dereference(self.as_ptr()))] // Ensure the pointer is valid to create a reference.
143-
#[ensures(|result: &&MaybeUninit<T>| core::ptr::eq(*result, self.cast().as_ptr()))] // Ensure returned reference points to the correct memory location.
142+
#[requires(ub_checks::can_dereference(self.as_ptr()))] // Ensure the pointer is valid to create a reference.
143+
#[ensures(|result: &&MaybeUninit<T>| core::ptr::eq(*result, self.cast().as_ptr()))] // Ensure returned reference points to the correct memory location.
144144
pub const unsafe fn as_uninit_ref<'a>(self) -> &'a MaybeUninit<T> {
145145
// SAFETY: the caller must guarantee that `self` meets all the
146146
// requirements for a reference.
@@ -165,8 +165,8 @@ impl<T: Sized> NonNull<T> {
165165
#[must_use]
166166
#[unstable(feature = "ptr_as_uninit", issue = "75402")]
167167
#[rustc_const_unstable(feature = "ptr_as_uninit", issue = "75402")]
168-
#[requires(ub_checks::can_dereference(self.as_ptr()))] // Ensure pointer is valid to create a mutable reference.
169-
#[ensures(|result: &&mut MaybeUninit<T>| core::ptr::eq(*result, self.cast().as_ptr()))] // Ensure the returned reference points to the correct memory.
168+
#[requires(ub_checks::can_dereference(self.as_ptr()))] // Ensure pointer is valid to create a mutable reference.
169+
#[ensures(|result: &&mut MaybeUninit<T>| core::ptr::eq(*result, self.cast().as_ptr()))] // Ensure the returned reference points to the correct memory.
170170
pub const unsafe fn as_uninit_mut<'a>(self) -> &'a mut MaybeUninit<T> {
171171
// SAFETY: the caller must guarantee that `self` meets all the
172172
// requirements for a reference.

0 commit comments

Comments
 (0)