Skip to content

Commit 6dfe033

Browse files
committed
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
2 parents a318d1c + 9e23000 commit 6dfe033

File tree

1 file changed

+4
-5
lines changed
  • src/libsyntax/parse/lexer

1 file changed

+4
-5
lines changed

src/libsyntax/parse/lexer/mod.rs

+4-5
Original file line numberDiff line numberDiff line change
@@ -931,11 +931,10 @@ impl<'a> StringReader<'a> {
931931
_ => {
932932
if ascii_only && first_source_char > '\x7F' {
933933
let last_pos = self.last_pos;
934-
self.err_span_char(start,
935-
last_pos,
936-
"byte constant must be ASCII. Use a \\xHH escape for a \
937-
non-ASCII byte",
938-
first_source_char);
934+
self.err_span_(start,
935+
last_pos,
936+
"byte constant must be ASCII. Use a \\xHH escape for a \
937+
non-ASCII byte");
939938
return false;
940939
}
941940
}

0 commit comments

Comments
 (0)