about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDaniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>2020-11-04 14:54:22 +0100
committerDaniel Henry-Mantilla <daniel.henry.mantilla@gmail.com>2020-11-04 14:54:22 +0100
commit69e5729c58481e1a2ce4e4a5982d38deab1fc6b2 (patch)
tree72cbbeb4d21e07058e3e339418409d8dabdb5357
parent56293097f7f877f1350a6cd00f79d03132f16515 (diff)
downloadrust-69e5729c58481e1a2ce4e4a5982d38deab1fc6b2.tar.gz
rust-69e5729c58481e1a2ce4e4a5982d38deab1fc6b2.zip
Simplify the implementation of `get_mut` (no unsafe)
-rw-r--r--library/core/src/cell.rs3
1 files changed, 1 insertions, 2 deletions
diff --git a/library/core/src/cell.rs b/library/core/src/cell.rs
index 7140218fa91..ef2a5dd570f 100644
--- a/library/core/src/cell.rs
+++ b/library/core/src/cell.rs
@@ -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.