Skip to content

Commit

Permalink
Fix as_{,mut}_ptr methods
Browse files Browse the repository at this point in the history
  • Loading branch information
canndrew committed Mar 16, 2018
1 parent b4a4734 commit 835f860
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions text/0000-uninitialized-uninhabited.md
Original file line number Diff line number Diff line change
Expand Up @@ -202,13 +202,13 @@ impl<T> MaybeUninit<T> {
/// Get a pointer to the contained value. This pointer will only be valid if the `MaybeUninit`
/// is in an initialized state.
pub fn as_ptr(&self) -> *const T {
unsafe { &self.value as *const T }
self as *const MaybeUninit<T> as *const T
}

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

0 comments on commit 835f860

Please sign in to comment.