diff options
| author | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-03 10:15:35 +0000 |
|---|---|---|
| committer | Camille GILLOT <gillot.camille@gmail.com> | 2023-09-03 12:56:10 +0000 |
| commit | 258ace613da6b8c90ba4995738cb13791388c4bb (patch) | |
| tree | 86baeb6af697ff1ce06e94ef72305a8bd5b8029c /compiler/rustc_span/src/source_map | |
| parent | 585bb5e68d85c1e4f32da3e2499343372626a436 (diff) | |
Use relative positions inside a SourceFile.
Diffstat (limited to 'compiler/rustc_span/src/source_map')
| -rw-r--r-- | compiler/rustc_span/src/source_map/tests.rs | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/compiler/rustc_span/src/source_map/tests.rs b/compiler/rustc_span/src/source_map/tests.rs index 686b3b00d70..d5cb3dac55c 100644 --- a/compiler/rustc_span/src/source_map/tests.rs +++ b/compiler/rustc_span/src/source_map/tests.rs @@ -50,6 +50,7 @@ impl SourceMap { fn bytepos_to_file_charpos(&self, bpos: BytePos) -> CharPos { let idx = self.lookup_source_file_idx(bpos); let sf = &(*self.files.borrow().source_files)[idx]; + let bpos = sf.relative_position(bpos); sf.bytepos_to_file_charpos(bpos) } } @@ -230,8 +231,7 @@ fn t10() { let SourceFile { name, src_hash, - start_pos, - end_pos, + source_len, lines, multibyte_chars, non_narrow_chars, @@ -244,13 +244,12 @@ fn t10() { name, src_hash, name_hash, - (end_pos - start_pos).to_usize(), + source_len.to_usize(), CrateNum::new(0), lines, multibyte_chars, non_narrow_chars, normalized_pos, - start_pos, 0, ); |
