mirror of
https://github.com/tokio-rs/tokio.git
synced 2025-09-25 12:00:35 +00:00
sync: use UnsafeCell::get_mut
in Mutex::get_mut
and RwLock::get_mut
(#7569)
This commit is contained in:
parent
d1e06f831e
commit
a99a351802
@ -716,10 +716,7 @@ impl<T: ?Sized> Mutex<T> {
|
||||
/// }
|
||||
/// ```
|
||||
pub fn get_mut(&mut self) -> &mut T {
|
||||
unsafe {
|
||||
// Safety: This is https://github.com/rust-lang/rust/pull/76936
|
||||
&mut *self.c.get()
|
||||
}
|
||||
self.c.get_mut()
|
||||
}
|
||||
|
||||
/// Attempts to acquire the lock, and returns [`TryLockError`] if the lock
|
||||
|
@ -1073,10 +1073,7 @@ impl<T: ?Sized> RwLock<T> {
|
||||
/// }
|
||||
/// ```
|
||||
pub fn get_mut(&mut self) -> &mut T {
|
||||
unsafe {
|
||||
// Safety: This is https://github.com/rust-lang/rust/pull/76936
|
||||
&mut *self.c.get()
|
||||
}
|
||||
self.c.get_mut()
|
||||
}
|
||||
|
||||
/// Consumes the lock, returning the underlying data.
|
||||
|
Loading…
x
Reference in New Issue
Block a user