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:
commit
29fad213b2
@ -1733,8 +1733,7 @@ impl<T: ?Sized> UnsafeCell<T> {
|
|||||||
#[inline]
|
#[inline]
|
||||||
#[unstable(feature = "unsafe_cell_get_mut", issue = "76943")]
|
#[unstable(feature = "unsafe_cell_get_mut", issue = "76943")]
|
||||||
pub fn get_mut(&mut self) -> &mut T {
|
pub fn get_mut(&mut self) -> &mut T {
|
||||||
// SAFETY: (outer) `&mut` guarantees unique access.
|
&mut self.value
|
||||||
unsafe { &mut *self.get() }
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Gets a mutable pointer to the wrapped value.
|
/// Gets a mutable pointer to the wrapped value.
|
||||||
|
Loading…
Reference in New Issue
Block a user