Skip to content

Commit d1f6892

Browse files
committed
Lint on invalid UnsafeCell::raw_get with invalid_reference_casting lint
1 parent 7353e84 commit d1f6892

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

core/src/cell.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2131,6 +2131,7 @@ impl<T: ?Sized> UnsafeCell<T> {
21312131
#[inline(always)]
21322132
#[stable(feature = "unsafe_cell_raw_get", since = "1.56.0")]
21332133
#[rustc_const_stable(feature = "unsafe_cell_raw_get", since = "1.56.0")]
2134+
#[rustc_diagnostic_item = "unsafe_cell_raw_get"]
21342135
pub const fn raw_get(this: *const Self) -> *mut T {
21352136
// We can just cast the pointer from `UnsafeCell<T>` to `T` because of
21362137
// #[repr(transparent)]. This exploits std's special status, there is

0 commit comments

Comments
 (0)