diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2022-08-06 22:33:06 +0200 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2022-08-06 22:33:06 +0200 |
| commit | f20ceb1c6fd7fa29a91677be548d6f8ca6c4b172 (patch) | |
| tree | 0ca3de1afd8d7fd9f648263550c4fa4ed91f9b45 /compiler/rustc_span/src | |
| parent | 55f46419afd2e49acfc6be176ad4aeadaa5686d7 (diff) | |
| download | rust-f20ceb1c6fd7fa29a91677be548d6f8ca6c4b172.tar.gz rust-f20ceb1c6fd7fa29a91677be548d6f8ca6c4b172.zip | |
Encode index of SourceFile along with span.
Diffstat (limited to 'compiler/rustc_span/src')
| -rw-r--r-- | compiler/rustc_span/src/lib.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_span/src/source_map.rs | 2 | ||||
| -rw-r--r-- | compiler/rustc_span/src/source_map/tests.rs | 1 |
3 files changed, 5 insertions, 0 deletions
diff --git a/compiler/rustc_span/src/lib.rs b/compiler/rustc_span/src/lib.rs index cf306928151..bae05f2f02e 100644 --- a/compiler/rustc_span/src/lib.rs +++ b/compiler/rustc_span/src/lib.rs @@ -1098,6 +1098,8 @@ pub enum ExternalSource { original_start_pos: BytePos, /// The end of this SourceFile within the source_map of its original crate. original_end_pos: BytePos, + /// Index of the file inside metadata. + metadata_index: u32, }, } diff --git a/compiler/rustc_span/src/source_map.rs b/compiler/rustc_span/src/source_map.rs index 28381157d50..387777f7af6 100644 --- a/compiler/rustc_span/src/source_map.rs +++ b/compiler/rustc_span/src/source_map.rs @@ -337,6 +337,7 @@ impl SourceMap { mut file_local_normalized_pos: Vec<NormalizedPos>, original_start_pos: BytePos, original_end_pos: BytePos, + metadata_index: u32, ) -> Lrc<SourceFile> { let start_pos = self .allocate_address_space(source_len) @@ -383,6 +384,7 @@ impl SourceMap { kind: ExternalSourceKind::AbsentOk, original_start_pos, original_end_pos, + metadata_index, }), start_pos, end_pos, diff --git a/compiler/rustc_span/src/source_map/tests.rs b/compiler/rustc_span/src/source_map/tests.rs index be827cea874..2cada019b7f 100644 --- a/compiler/rustc_span/src/source_map/tests.rs +++ b/compiler/rustc_span/src/source_map/tests.rs @@ -252,6 +252,7 @@ fn t10() { normalized_pos, start_pos, end_pos, + 0, ); assert!( |
