@@ -12,7 +12,7 @@ pub use crate::*;
12
12
13
13
use rustc_data_structures:: fx:: FxHashMap ;
14
14
use rustc_data_structures:: stable_hasher:: StableHasher ;
15
- use rustc_data_structures:: sync:: { AtomicU32 , Lock , LockGuard , Lrc , MappedLockGuard } ;
15
+ use rustc_data_structures:: sync:: { AtomicU32 , Lrc , MappedReadGuard , ReadGuard , RwLock } ;
16
16
use std:: cmp;
17
17
use std:: convert:: TryFrom ;
18
18
use std:: hash:: Hash ;
@@ -168,7 +168,7 @@ pub struct SourceMap {
168
168
/// The address space below this value is currently used by the files in the source map.
169
169
used_address_space : AtomicU32 ,
170
170
171
- files : Lock < SourceMapFiles > ,
171
+ files : RwLock < SourceMapFiles > ,
172
172
file_loader : Box < dyn FileLoader + Sync + Send > ,
173
173
// This is used to apply the file path remapping as specified via
174
174
// `--remap-path-prefix` to all `SourceFile`s allocated within this `SourceMap`.
@@ -236,8 +236,8 @@ impl SourceMap {
236
236
237
237
// By returning a `MonotonicVec`, we ensure that consumers cannot invalidate
238
238
// any existing indices pointing into `files`.
239
- pub fn files ( & self ) -> MappedLockGuard < ' _ , monotonic:: MonotonicVec < Lrc < SourceFile > > > {
240
- LockGuard :: map ( self . files . borrow ( ) , |files| & mut files. source_files )
239
+ pub fn files ( & self ) -> MappedReadGuard < ' _ , monotonic:: MonotonicVec < Lrc < SourceFile > > > {
240
+ ReadGuard :: map ( self . files . borrow ( ) , |files| & files. source_files )
241
241
}
242
242
243
243
pub fn source_file_by_stable_id (
0 commit comments