diff options
| author | Simonas Kazlauskas <git@kazlauskas.me> | 2015-07-10 21:41:37 +0300 |
|---|---|---|
| committer | Simonas Kazlauskas <git@kazlauskas.me> | 2015-07-10 22:28:51 +0300 |
| commit | d22f189da13f8ffb3c9227a038615608e99a6211 (patch) | |
| tree | 43490b64f18f182cdd3e58ad26a4eb222a5528da | |
| parent | 0bd5dd6449c9db734bd2d1700ea4b50e22b220be (diff) | |
| download | rust-d22f189da13f8ffb3c9227a038615608e99a6211.tar.gz rust-d22f189da13f8ffb3c9227a038615608e99a6211.zip | |
Improve some of the string escape diagnostic spans
| -rw-r--r-- | src/libsyntax/parse/lexer/mod.rs | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs index b5085b5c44c..edaac3b09ba 100644 --- a/src/libsyntax/parse/lexer/mod.rs +++ b/src/libsyntax/parse/lexer/mod.rs @@ -742,7 +742,7 @@ impl<'a> StringReader<'a> { let valid = self.scan_unicode_escape(delim); if valid && ascii_only { self.err_span_( - escaped_pos, + start, self.last_pos, "unicode escape sequences cannot be used as a byte or in \ a byte string" @@ -753,9 +753,9 @@ impl<'a> StringReader<'a> { } } 'u' if !ascii_only => { - self.err_span_(escaped_pos, self.last_pos, + self.err_span_(start, self.last_pos, "incomplete unicode escape sequence"); - self.help_span_(escaped_pos, self.last_pos, + self.help_span_(start, self.last_pos, "format of unicode escape sequences is `\\u{…}`"); false } @@ -862,14 +862,12 @@ impl<'a> StringReader<'a> { valid = false; } - self.bump(); // past the ending } - if valid && (char::from_u32(accum_int).is_none() || count == 0) { self.err_span_(start_bpos, self.last_pos, "illegal unicode character escape"); valid = false; } - + self.bump(); // past the ending } valid } |
