From a22ffadbebddcbec9bb127b295f8a8516174e6e6 Mon Sep 17 00:00:00 2001 From: Mica White Date: Mon, 11 Mar 2024 22:41:13 -0400 Subject: More trait bound fixes --- src/rwlock.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/rwlock.rs') diff --git a/src/rwlock.rs b/src/rwlock.rs index f11b204..df68fc5 100644 --- a/src/rwlock.rs +++ b/src/rwlock.rs @@ -67,10 +67,16 @@ pub struct ReadLock<'a, T: ?Sized, R>(&'a RwLock); pub struct WriteLock<'a, T: ?Sized, R>(&'a RwLock); /// RAII structure that unlocks the shared read access to a [`RwLock`] -pub struct RwLockReadRef<'a, T: ?Sized, R: RawRwLock>(&'a RwLock); +pub struct RwLockReadRef<'a, T: ?Sized, R: RawRwLock>( + &'a RwLock, + PhantomData<(&'a mut T, R::GuardMarker)>, +); /// RAII structure that unlocks the exclusive write access to a [`RwLock`] -pub struct RwLockWriteRef<'a, T: ?Sized, R: RawRwLock>(&'a RwLock); +pub struct RwLockWriteRef<'a, T: ?Sized, R: RawRwLock>( + &'a RwLock, + PhantomData<(&'a mut T, R::GuardMarker)>, +); /// RAII structure used to release the shared read access of a lock when /// dropped. @@ -84,7 +90,6 @@ pub struct RwLockReadGuard<'a, 'key, T: ?Sized, Key: Keyable + 'key, R: RawRwLoc rwlock: RwLockReadRef<'a, T, R>, thread_key: Key, _phantom1: PhantomData<&'key ()>, - _phantom2: PhantomData<*const ()>, } /// RAII structure used to release the exclusive write access of a lock when @@ -98,5 +103,4 @@ pub struct RwLockWriteGuard<'a, 'key, T: ?Sized, Key: Keyable + 'key, R: RawRwLo rwlock: RwLockWriteRef<'a, T, R>, thread_key: Key, _phantom1: PhantomData<&'key ()>, - _phantom2: PhantomData<*const ()>, } -- cgit v1.2.3