mirror of
https://github.com/allankoechke/rust.git
synced 2026-12-05 01:24:03 +00:00
Allow `UnsafeCell` content access without `get` in `invalid_reference_casting` lint https://github.com/rust-lang/rust/pull/159730 relaxed the rules so that it's no longer necessary to use `UnsafeCell::raw_get` or `UnsafeCell::get` to access the content of an unsafe cell. As a consequence this means that code this like is no longer invalid: ```rust use std::cell::UnsafeCell; unsafe fn get_mut_unchecked<T>(ptr: &UnsafeCell<T>) -> &mut T { let t = ptr as *const UnsafeCell<T> as *mut T; unsafe { &mut *t } } ``` Fixes https://github.com/rust-lang/rust/issues/159915 cc @RalfJung