Skip to content

Commit

Permalink
Rollup merge of #78735 - danielhenrymantilla:simplify-unsafecell-getm…
Browse files Browse the repository at this point in the history
…ut, 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````
  • Loading branch information
m-ou-se committed Nov 5, 2020
2 parents 8640360 + 69e5729 commit 29fad21
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions library/core/src/cell.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1733,8 +1733,7 @@ impl<T: ?Sized> UnsafeCell<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.
Expand Down

0 comments on commit 29fad21

Please sign in to comment.