@@ -110,23 +110,52 @@ pub const RW_LOCK_INIT: StaticRwLock = StaticRwLock {
110110/// dropped.
111111#[ must_use]
112112#[ stable]
113+ #[ cfg( stage0) ] // NOTE remove impl after next snapshot
113114pub struct RwLockReadGuard < ' a , T : ' a > {
114115 __lock : & ' a StaticRwLock ,
115116 __data : & ' a UnsafeCell < T > ,
116117 __marker : marker:: NoSend ,
117118}
118119
120+ /// RAII structure used to release the shared read access of a lock when
121+ /// dropped.
122+ #[ must_use]
123+ #[ stable]
124+ #[ cfg( not( stage0) ) ] // NOTE remove cfg after next snapshot
125+ pub struct RwLockReadGuard < ' a , T : ' a > {
126+ __lock : & ' a StaticRwLock ,
127+ __data : & ' a UnsafeCell < T > ,
128+ }
129+
130+ #[ cfg( not( stage0) ) ] // NOTE remove cfg after next snapshot
131+ impl < ' a , T > !marker:: Send for RwLockReadGuard < ' a , T > { }
132+
119133/// RAII structure used to release the exclusive write access of a lock when
120134/// dropped.
121135#[ must_use]
122136#[ stable]
137+ #[ cfg( stage0) ] // NOTE remove impl after next snapshot
123138pub struct RwLockWriteGuard < ' a , T : ' a > {
124139 __lock : & ' a StaticRwLock ,
125140 __data : & ' a UnsafeCell < T > ,
126141 __poison : poison:: Guard ,
127142 __marker : marker:: NoSend ,
128143}
129144
145+ /// RAII structure used to release the exclusive write access of a lock when
146+ /// dropped.
147+ #[ must_use]
148+ #[ stable]
149+ #[ cfg( not( stage0) ) ] // NOTE remove cfg after next snapshot
150+ pub struct RwLockWriteGuard < ' a , T : ' a > {
151+ __lock : & ' a StaticRwLock ,
152+ __data : & ' a UnsafeCell < T > ,
153+ __poison : poison:: Guard ,
154+ }
155+
156+ #[ cfg( not( stage0) ) ] // NOTE remove cfg after next snapshot
157+ impl < ' a , T > !marker:: Send for RwLockWriteGuard < ' a , T > { }
158+
130159impl < T : Send + Sync > RwLock < T > {
131160 /// Creates a new instance of an RwLock which is unlocked and read to go.
132161 #[ stable]
@@ -303,6 +332,7 @@ impl StaticRwLock {
303332}
304333
305334impl < ' rwlock , T > RwLockReadGuard < ' rwlock , T > {
335+ #[ cfg( stage0) ] // NOTE remove impl after next snapshot
306336 fn new ( lock : & ' rwlock StaticRwLock , data : & ' rwlock UnsafeCell < T > )
307337 -> LockResult < RwLockReadGuard < ' rwlock , T > > {
308338 poison:: map_result ( lock. poison . borrow ( ) , |_| {
@@ -313,8 +343,20 @@ impl<'rwlock, T> RwLockReadGuard<'rwlock, T> {
313343 }
314344 } )
315345 }
346+
347+ #[ cfg( not( stage0) ) ] // NOTE remove cfg after next snapshot
348+ fn new ( lock : & ' rwlock StaticRwLock , data : & ' rwlock UnsafeCell < T > )
349+ -> LockResult < RwLockReadGuard < ' rwlock , T > > {
350+ poison:: map_result ( lock. poison . borrow ( ) , |_| {
351+ RwLockReadGuard {
352+ __lock : lock,
353+ __data : data,
354+ }
355+ } )
356+ }
316357}
317358impl < ' rwlock , T > RwLockWriteGuard < ' rwlock , T > {
359+ #[ cfg( stage0) ] // NOTE remove impl after next snapshot
318360 fn new ( lock : & ' rwlock StaticRwLock , data : & ' rwlock UnsafeCell < T > )
319361 -> LockResult < RwLockWriteGuard < ' rwlock , T > > {
320362 poison:: map_result ( lock. poison . borrow ( ) , |guard| {
@@ -326,6 +368,18 @@ impl<'rwlock, T> RwLockWriteGuard<'rwlock, T> {
326368 }
327369 } )
328370 }
371+
372+ #[ cfg( not( stage0) ) ] // NOTE remove cfg after next snapshot
373+ fn new ( lock : & ' rwlock StaticRwLock , data : & ' rwlock UnsafeCell < T > )
374+ -> LockResult < RwLockWriteGuard < ' rwlock , T > > {
375+ poison:: map_result ( lock. poison . borrow ( ) , |guard| {
376+ RwLockWriteGuard {
377+ __lock : lock,
378+ __data : data,
379+ __poison : guard,
380+ }
381+ } )
382+ }
329383}
330384
331385#[ stable]
0 commit comments