diff options
| author | bors <bors@rust-lang.org> | 2018-06-28 11:20:41 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2018-06-28 11:20:41 +0000 |
| commit | 9f79d2f86af73da483f4fe8e2422c15c79221d32 (patch) | |
| tree | b7ecb398641e49cb195212763ae13c5d4a28a537 /src/librustc_metadata/decoder.rs | |
| parent | d84ad59710728c936edd7396e287d42f1e319cf1 (diff) | |
| parent | a1f8a6ce80a340d51074071c0d9e30eb14f65d25 (diff) | |
| download | rust-9f79d2f86af73da483f4fe8e2422c15c79221d32.tar.gz rust-9f79d2f86af73da483f4fe8e2422c15c79221d32.zip | |
Auto merge of #50997 - michaelwoerister:pre-analyze-filemaps, r=Mark-Simulacrum
Make FileMap::{lines, multibyte_chars, non_narrow_chars} non-mutable.
This PR removes most of the interior mutability from `FileMap`, which should be beneficial, especially in a multithreaded setting. This is achieved by initializing the state in question when the filemap is constructed instead of during lexing. Hopefully this doesn't degrade performance.
cc @wesleywiser
Diffstat (limited to 'src/librustc_metadata/decoder.rs')
| -rw-r--r-- | src/librustc_metadata/decoder.rs | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/src/librustc_metadata/decoder.rs b/src/librustc_metadata/decoder.rs index 6eea4b2617c..1985900b3e1 100644 --- a/src/librustc_metadata/decoder.rs +++ b/src/librustc_metadata/decoder.rs @@ -1138,9 +1138,9 @@ impl<'a, 'tcx> CrateMetadata { src_hash, start_pos, end_pos, - lines, - multibyte_chars, - non_narrow_chars, + mut lines, + mut multibyte_chars, + mut non_narrow_chars, name_hash, .. } = filemap_to_import; @@ -1151,15 +1151,12 @@ impl<'a, 'tcx> CrateMetadata { // `CodeMap::new_imported_filemap()` will then translate those // coordinates to their new global frame of reference when the // offset of the FileMap is known. - let mut lines = lines.into_inner(); for pos in &mut lines { *pos = *pos - start_pos; } - let mut multibyte_chars = multibyte_chars.into_inner(); for mbc in &mut multibyte_chars { mbc.pos = mbc.pos - start_pos; } - let mut non_narrow_chars = non_narrow_chars.into_inner(); for swc in &mut non_narrow_chars { *swc = *swc - start_pos; } |
