Lint on invalid UnsafeCell::raw_get with invalid_reference_casting lint
This commit is contained in:
@@ -2131,6 +2131,7 @@ impl<T: ?Sized> UnsafeCell<T> {
|
||||
#[inline(always)]
|
||||
#[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 {
|
||||
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
|
||||
// #[repr(transparent)]. This exploits std's special status, there is
|
||||
|
||||
Reference in New Issue
Block a user