Skip to content

Commit

Permalink
make things ugly
Browse files Browse the repository at this point in the history
  • Loading branch information
RalfJung committed Nov 13, 2019
1 parent 5b5ae01 commit 861698a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/libcore/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1572,18 +1572,18 @@ impl<T: ?Sized> UnsafeCell<T> {
/// use std::mem::MaybeUninit;
///
/// let m = MaybeUninit::<UnsafeCell<i32>>::uninit();
/// unsafe { m.as_ptr().raw_get().write(5); }
/// unsafe { UnsafeCell::raw_get(m.as_ptr()).write(5); }
/// let uc = unsafe { m.assume_init() };
///
/// assert_eq!(uc.into_inner(), 5);
/// ```
#[inline]
#[unstable(feature = "unsafe_cell_raw_get", issue = "66358")]
pub const fn raw_get(self: *const Self) -> *mut T {
pub const fn raw_get(this: *const Self) -> *mut T {
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
// #[repr(transparent)]. This exploits libstd's special status, there is
// no guarantee for user code that this will work in future versions of the compiler!
self as *const T as *mut T
this as *const T as *mut T
}
}

Expand Down

0 comments on commit 861698a

Please sign in to comment.