diff options
| author | Huon Wilson <dbau.pp+github@gmail.com> | 2014-02-23 16:40:04 +1100 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2014-02-24 21:22:26 -0800 |
| commit | ff79a4471cbf5fa4e78fcf56be129a3d56690127 (patch) | |
| tree | 6835775de94115c4f499981198c8b618330dd2fd /src/libsyntax/parse | |
| parent | dad52cfcb58cb30170c6247f2053bc0f0d57466a (diff) | |
| download | rust-ff79a4471cbf5fa4e78fcf56be129a3d56690127.tar.gz rust-ff79a4471cbf5fa4e78fcf56be129a3d56690127.zip | |
syntax: record multibyte chars' positions absolutely, not relative to
file. Previously multibyte UTF-8 chars were being recorded as byte offsets from the start of the file, and then later compared against global byte positions, resulting in the compiler possibly thinking it had a byte position pointing inside a multibyte character, if there were multibyte characters in any non-crate files. (Although, sometimes the byte offsets line up just right to not ICE, but that was a coincidence.) Fixes #11136. Fixes #11178.
Diffstat (limited to 'src/libsyntax/parse')
| -rw-r--r-- | src/libsyntax/parse/lexer.rs | 3 |
1 files changed, 1 insertions, 2 deletions
diff --git a/src/libsyntax/parse/lexer.rs b/src/libsyntax/parse/lexer.rs index b711e95bc94..5bace75a5ea 100644 --- a/src/libsyntax/parse/lexer.rs +++ b/src/libsyntax/parse/lexer.rs @@ -264,8 +264,7 @@ pub fn bump(rdr: &StringReader) { } if byte_offset_diff > 1 { - rdr.filemap.record_multibyte_char( - Pos::from_uint(current_byte_offset), byte_offset_diff); + rdr.filemap.record_multibyte_char(rdr.last_pos.get(), byte_offset_diff); } } else { rdr.curr.set(None); |
