diff options
| author | Wonwoo Choi <chwo9843@gmail.com> | 2017-11-02 10:25:54 +0900 |
|---|---|---|
| committer | Wonwoo Choi <chwo9843@gmail.com> | 2017-11-03 03:15:39 +0900 |
| commit | 272c2faa1d766fd4185141106959cdb58b88e6e9 (patch) | |
| tree | 2871d83d8d22fb2f83259d6c836fcad23205fae4 /src/librustc/ich/impls_syntax.rs | |
| parent | 2be4cc040211a85b17f21e813ff62351ae4de642 (diff) | |
| download | rust-272c2faa1d766fd4185141106959cdb58b88e6e9.tar.gz rust-272c2faa1d766fd4185141106959cdb58b88e6e9.zip | |
Display spans correctly when there are non-half-width characters
Diffstat (limited to 'src/librustc/ich/impls_syntax.rs')
| -rw-r--r-- | src/librustc/ich/impls_syntax.rs | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/librustc/ich/impls_syntax.rs b/src/librustc/ich/impls_syntax.rs index 799e790b85f..fea4e283db1 100644 --- a/src/librustc/ich/impls_syntax.rs +++ b/src/librustc/ich/impls_syntax.rs @@ -364,6 +364,7 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for FileMap { end_pos: _, ref lines, ref multibyte_chars, + ref non_narrow_chars, } = *self; name.hash_stable(hcx, hasher); @@ -389,6 +390,12 @@ impl<'gcx> HashStable<StableHashingContext<'gcx>> for FileMap { for &char_pos in multibyte_chars.iter() { stable_multibyte_char(char_pos, start_pos).hash_stable(hcx, hasher); } + + let non_narrow_chars = non_narrow_chars.borrow(); + non_narrow_chars.len().hash_stable(hcx, hasher); + for &char_pos in non_narrow_chars.iter() { + stable_non_narrow_char(char_pos, start_pos).hash_stable(hcx, hasher); + } } } @@ -408,3 +415,12 @@ fn stable_multibyte_char(mbc: ::syntax_pos::MultiByteChar, (pos.0 - filemap_start.0, bytes as u32) } + +fn stable_non_narrow_char(swc: ::syntax_pos::NonNarrowChar, + filemap_start: ::syntax_pos::BytePos) + -> (u32, u32) { + let pos = swc.pos(); + let width = swc.width(); + + (pos.0 - filemap_start.0, width as u32) +} |
