about summary refs log tree commit diff
path: root/src/libsyntax/parse
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2016-05-03 01:02:45 +0530
committerManish Goregaokar <manishsmail@gmail.com>2016-05-03 08:05:29 +0530
commitac19fdc09c47f0402f840173d31955647516331b (patch)
tree4853a3d043cd89dc2b0d7d1e82fe4077b76b3a47 /src/libsyntax/parse
parent7e88dc77605dfaa3b6b2388f3a4c3bb92c85801b (diff)
parent9e2300015bc2a88f8f3f81d208f5dfcc1c45d31d (diff)
downloadrust-ac19fdc09c47f0402f840173d31955647516331b.tar.gz
rust-ac19fdc09c47f0402f840173d31955647516331b.zip
Rollup merge of #33334 - birkenfeld:issue29088, r=Manishearth
lexer: do not display char confusingly in error message

Current code leads to messages like `... use a \xHH escape: \u{e4}` which is confusing.

The printed span already points to the offending character, which should be enough to identify the non-ASCII problem.

Fixes: #29088
Diffstat (limited to 'src/libsyntax/parse')
-rw-r--r--src/libsyntax/parse/lexer/mod.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/libsyntax/parse/lexer/mod.rs b/src/libsyntax/parse/lexer/mod.rs
index 881663a056c..da62e5286d4 100644
--- a/src/libsyntax/parse/lexer/mod.rs
+++ b/src/libsyntax/parse/lexer/mod.rs
@@ -931,11 +931,10 @@ impl<'a> StringReader<'a> {
             _ => {
                 if ascii_only && first_source_char > '\x7F' {
                     let last_pos = self.last_pos;
-                    self.err_span_char(start,
-                                       last_pos,
-                                       "byte constant must be ASCII. Use a \\xHH escape for a \
-                                        non-ASCII byte",
-                                       first_source_char);
+                    self.err_span_(start,
+                                   last_pos,
+                                   "byte constant must be ASCII. Use a \\xHH escape for a \
+                                    non-ASCII byte");
                     return false;
                 }
             }