mirror of
https://github.com/rust-lang/rust.git
synced 2026-05-17 05:25:37 +03:00
Rollup merge of #78735 - danielhenrymantilla:simplify-unsafecell-getmut, r=RalfJung
Simplify the implementation of `get_mut` (no unsafe) Quick PR to reduce one use of `unsafe` pointed out in the previous PR r? ````@RalfJung````
This commit is contained in:
@@ -1733,8 +1733,7 @@ pub const fn get(&self) -> *mut T {
|
||||
#[inline]
|
||||
#[unstable(feature = "unsafe_cell_get_mut", issue = "76943")]
|
||||
pub fn get_mut(&mut self) -> &mut T {
|
||||
// SAFETY: (outer) `&mut` guarantees unique access.
|
||||
unsafe { &mut *self.get() }
|
||||
&mut self.value
|
||||
}
|
||||
|
||||
/// Gets a mutable pointer to the wrapped value.
|
||||
|
||||
Reference in New Issue
Block a user