Skip to content

Commit 835f860

Browse files
committed
Fix as_{,mut}_ptr methods
1 parent b4a4734 commit 835f860

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

text/0000-uninitialized-uninhabited.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,13 @@ impl<T> MaybeUninit<T> {
202202
/// Get a pointer to the contained value. This pointer will only be valid if the `MaybeUninit`
203203
/// is in an initialized state.
204204
pub fn as_ptr(&self) -> *const T {
205-
unsafe { &self.value as *const T }
205+
self as *const MaybeUninit<T> as *const T
206206
}
207207

208208
/// Get a mutable pointer to the contained value. This pointer will only be valid if the
209209
/// `MaybeUninit` is in an initialized state.
210210
pub fn as_mut_ptr(&mut self) -> *mut T {
211-
unsafe { &mut self.value as *mut T }
211+
self as *mut MaybeUninit<T> as *mut T
212212
}
213213
}
214214
```

0 commit comments

Comments
 (0)