We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent fa1656e commit 09d937eCopy full SHA for 09d937e
library/std/src/sync/rwlock.rs
@@ -102,6 +102,10 @@ unsafe impl<T: ?Sized + Send + Sync> Sync for RwLock<T> {}
102
#[stable(feature = "rust1", since = "1.0.0")]
103
#[clippy::has_significant_drop]
104
pub struct RwLockReadGuard<'a, T: ?Sized + 'a> {
105
+ // NB: we use a pointer instead of `&'a T` to avoid `noalias` violations, because a
106
+ // `Ref` argument doesn't hold immutability for its whole scope, only until it drops.
107
+ // `NonNull` is also covariant over `T`, just like we would have with `&T`. `NonNull`
108
+ // is preferable over `const* T` to allow for niche optimization.
109
data: NonNull<T>,
110
inner_lock: &'a sys::MovableRwLock,
111
}
0 commit comments