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
This commit is contained in:
@@ -931,11 +931,10 @@ impl<'a> StringReader<'a> {
|
|||||||
_ => {
|
_ => {
|
||||||
if ascii_only && first_source_char > '\x7F' {
|
if ascii_only && first_source_char > '\x7F' {
|
||||||
let last_pos = self.last_pos;
|
let last_pos = self.last_pos;
|
||||||
self.err_span_char(start,
|
self.err_span_(start,
|
||||||
last_pos,
|
last_pos,
|
||||||
"byte constant must be ASCII. Use a \\xHH escape for a \
|
"byte constant must be ASCII. Use a \\xHH escape for a \
|
||||||
non-ASCII byte",
|
non-ASCII byte");
|
||||||
first_source_char);
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user