@@ -246,16 +246,8 @@ cfg_if! {
246
246
247
247
pub type MetadataRef = OwnedSlice ;
248
248
249
- pub use std:: cell:: Ref as ReadGuard ;
250
- pub use std:: cell:: Ref as MappedReadGuard ;
251
- pub use std:: cell:: RefMut as WriteGuard ;
252
- pub use std:: cell:: RefMut as MappedWriteGuard ;
253
- pub use std:: cell:: RefMut as MappedLockGuard ;
254
-
255
249
pub use std:: cell:: OnceCell ;
256
250
257
- use std:: cell:: RefCell as InnerRwLock ;
258
-
259
251
pub type MTLockRef <' a, T > = & ' a mut MTLock <T >;
260
252
261
253
#[ derive( Debug , Default ) ]
@@ -299,13 +291,6 @@ cfg_if! {
299
291
pub use std:: marker:: Send as Send ;
300
292
pub use std:: marker:: Sync as Sync ;
301
293
302
- pub use parking_lot:: RwLockReadGuard as ReadGuard ;
303
- pub use parking_lot:: MappedRwLockReadGuard as MappedReadGuard ;
304
- pub use parking_lot:: RwLockWriteGuard as WriteGuard ;
305
- pub use parking_lot:: MappedRwLockWriteGuard as MappedWriteGuard ;
306
-
307
- pub use parking_lot:: MappedMutexGuard as MappedLockGuard ;
308
-
309
294
pub use std:: sync:: OnceLock as OnceCell ;
310
295
311
296
pub use std:: sync:: atomic:: { AtomicBool , AtomicUsize , AtomicU32 , AtomicU64 } ;
@@ -342,8 +327,6 @@ cfg_if! {
342
327
}
343
328
}
344
329
345
- use parking_lot:: RwLock as InnerRwLock ;
346
-
347
330
use std:: thread;
348
331
349
332
#[ inline]
@@ -508,14 +491,22 @@ cfg_if! {
508
491
509
492
pub type MetadataRef = OwnedSlice ;
510
493
511
- /// This makes locks panic if they are already held.
512
- /// It is only useful when you are running in a single thread
513
- const ERROR_CHECKING : bool = false ;
514
494
}
515
495
}
516
496
517
497
pub use std:: sync:: Arc as Lrc ;
518
498
499
+ use parking_lot:: RwLock as InnerRwLock ;
500
+
501
+ pub use parking_lot:: MappedRwLockReadGuard as MappedReadGuard ;
502
+ pub use parking_lot:: MappedRwLockWriteGuard as MappedWriteGuard ;
503
+ pub use parking_lot:: RwLockReadGuard as ReadGuard ;
504
+ pub use parking_lot:: RwLockWriteGuard as WriteGuard ;
505
+
506
+ /// This makes locks panic if they are already held.
507
+ /// It is only useful when you are running in a single thread
508
+ const ERROR_CHECKING : bool = false ;
509
+
519
510
pub unsafe trait DynSend { }
520
511
pub unsafe trait DynSync { }
521
512
@@ -742,14 +733,6 @@ impl<T> RwLock<T> {
742
733
self . 0 . get_mut ( )
743
734
}
744
735
745
- #[ cfg( not( parallel_compiler) ) ]
746
- #[ inline( always) ]
747
- #[ track_caller]
748
- pub fn read ( & self ) -> ReadGuard < ' _ , T > {
749
- self . 0 . borrow ( )
750
- }
751
-
752
- #[ cfg( parallel_compiler) ]
753
736
#[ inline( always) ]
754
737
pub fn read ( & self ) -> ReadGuard < ' _ , T > {
755
738
if ERROR_CHECKING {
@@ -765,26 +748,11 @@ impl<T> RwLock<T> {
765
748
f ( & * self . read ( ) )
766
749
}
767
750
768
- #[ cfg( not( parallel_compiler) ) ]
769
- #[ inline( always) ]
770
- pub fn try_write ( & self ) -> Result < WriteGuard < ' _ , T > , ( ) > {
771
- self . 0 . try_borrow_mut ( ) . map_err ( |_| ( ) )
772
- }
773
-
774
- #[ cfg( parallel_compiler) ]
775
751
#[ inline( always) ]
776
752
pub fn try_write ( & self ) -> Result < WriteGuard < ' _ , T > , ( ) > {
777
753
self . 0 . try_write ( ) . ok_or ( ( ) )
778
754
}
779
755
780
- #[ cfg( not( parallel_compiler) ) ]
781
- #[ inline( always) ]
782
- #[ track_caller]
783
- pub fn write ( & self ) -> WriteGuard < ' _ , T > {
784
- self . 0 . borrow_mut ( )
785
- }
786
-
787
- #[ cfg( parallel_compiler) ]
788
756
#[ inline( always) ]
789
757
pub fn write ( & self ) -> WriteGuard < ' _ , T > {
790
758
if ERROR_CHECKING {
@@ -812,13 +780,6 @@ impl<T> RwLock<T> {
812
780
self . write ( )
813
781
}
814
782
815
- #[ cfg( not( parallel_compiler) ) ]
816
- #[ inline( always) ]
817
- pub fn leak ( & self ) -> & T {
818
- ReadGuard :: leak ( self . read ( ) )
819
- }
820
-
821
- #[ cfg( parallel_compiler) ]
822
783
#[ inline( always) ]
823
784
pub fn leak ( & self ) -> & T {
824
785
let guard = self . read ( ) ;
0 commit comments