diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs index 030040ba09abb..7b597e6231038 100644 --- a/library/core/src/cell.rs +++ b/library/core/src/cell.rs @@ -2159,7 +2159,7 @@ impl UnsafeCell { /// use std::mem::MaybeUninit; /// /// let m = MaybeUninit::>::uninit(); - /// unsafe { UnsafeCell::raw_get(m.as_ptr()).write(5); } + /// unsafe { m.as_ptr().raw_get().write(5); } /// // avoid below which references to uninitialized data /// // unsafe { UnsafeCell::get(&*m.as_ptr()).write(5); } /// let uc = unsafe { m.assume_init() }; @@ -2170,11 +2170,11 @@ impl UnsafeCell { #[stable(feature = "unsafe_cell_raw_get", since = "1.56.0")] #[rustc_const_stable(feature = "unsafe_cell_raw_get", since = "1.56.0")] #[rustc_diagnostic_item = "unsafe_cell_raw_get"] - pub const fn raw_get(this: *const Self) -> *mut T { + pub const fn raw_get(self: *const Self) -> *mut T { // We can just cast the pointer from `UnsafeCell` to `T` because of // #[repr(transparent)]. This exploits std's special status, there is // no guarantee for user code that this will work in future versions of the compiler! - this as *const T as *mut T + self as *const T as *mut T } } @@ -2270,11 +2270,11 @@ impl SyncUnsafeCell { /// /// See [`UnsafeCell::get`] for details. #[inline] - pub const fn raw_get(this: *const Self) -> *mut T { + pub const fn raw_get(self: *const Self) -> *mut T { // We can just cast the pointer from `SyncUnsafeCell` to `T` because // of #[repr(transparent)] on both SyncUnsafeCell and UnsafeCell. // See UnsafeCell::raw_get. - this as *const T as *mut T + self as *const T as *mut T } } diff --git a/library/core/src/lib.rs b/library/core/src/lib.rs index 07720f235989b..541b87d8d706c 100644 --- a/library/core/src/lib.rs +++ b/library/core/src/lib.rs @@ -202,6 +202,7 @@ #![feature(adt_const_params)] #![feature(allow_internal_unsafe)] #![feature(allow_internal_unstable)] +#![feature(arbitrary_self_types)] #![feature(asm_const)] #![feature(associated_type_bounds)] #![feature(auto_traits)]