Skip to content

Commit cf1238e

Browse files
committed
Address comments
1 parent 391f800 commit cf1238e

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

library/std/src/sync/rwlock.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,8 +101,8 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
101101
#[stable(feature = "rust1", since = "1.0.0")]
102102
#[clippy::has_significant_drop]
103103
pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
104+
data: *const T,
104105
inner_lock: &'a sys::MovableRwLock,
105-
data: &'a T,
106106
}
107107

108108
#[stable(feature = "rust1", since = "1.0.0")]
@@ -513,7 +513,7 @@ impl<'rwlock, T: ?Sized> RwLockReadGuard<'rwlock, T> {
513513
unsafe fn new(lock: &'rwlock RwLock<T>) -> LockResult<RwLockReadGuard<'rwlock, T>> {
514514
poison::map_result(lock.poison.borrow(), |()| RwLockReadGuard {
515515
inner_lock: &lock.inner,
516-
data: &*lock.data.get(),
516+
data: lock.data.get(),
517517
})
518518
}
519519
}
@@ -557,7 +557,7 @@ impl<T: ?Sized> Deref for RwLockReadGuard<'_, T> {
557557
type Target = T;
558558

559559
fn deref(&self) -> &T {
560-
self.data
560+
unsafe { &*self.data }
561561
}
562562
}
563563

0 commit comments

Comments
 (0)