From: Robin Raymond Date: Fri, 13 May 2022 07:18:57 +0000 (+0000) Subject: Address comments X-Git-Url: https://git.lizzy.rs/?a=commitdiff_plain;h=cf1238e799b18f38a9c328b6700434e38f98cec7;p=rust.git Address comments --- diff --git a/library/std/src/sync/rwlock.rs b/library/std/src/sync/rwlock.rs index 22207b266fa..ac3c3b509cd 100644 --- a/library/std/src/sync/rwlock.rs +++ b/library/std/src/sync/rwlock.rs @@ -101,8 +101,8 @@ unsafe impl Sync for RwLock {} #[stable(feature = "rust1", since = "1.0.0")] #[clippy::has_significant_drop] pub struct RwLockReadGuard<'a, T: ?Sized + 'a> { + data: *const T, inner_lock: &'a sys::MovableRwLock, - data: &'a T, } #[stable(feature = "rust1", since = "1.0.0")] @@ -513,7 +513,7 @@ impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> { unsafe fn new(lock: &'rwlock RwLock) -> LockResult> { poison::map_result(lock.poison.borrow(), |()| RwLockReadGuard { inner_lock: &lock.inner, - data: &*lock.data.get(), + data: lock.data.get(), }) } } @@ -557,7 +557,7 @@ impl Deref for RwLockReadGuard<'_, T> { type Target = T; fn deref(&self) -> &T { - self.data + unsafe { &*self.data } } }