Skip to content

Commit

Permalink
Rollup merge of rust-lang#33334 - birkenfeld:issue29088, r=Manishearth
Browse files Browse the repository at this point in the history
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: rust-lang#29088
  • Loading branch information
Manishearth committed May 2, 2016
2 parents a318d1c + 9e23000 commit 6dfe033
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/libsyntax/parse/lexer/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
Expand Down

0 comments on commit 6dfe033

Please sign in to comment.