-
Notifications
You must be signed in to change notification settings - Fork 13k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confusing error message for non-ASCII byte literals #29088
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
Comments
I agree. As someone unfamiliar with the language the error message lead me to fix the playpen code like this: fn main() { Which leads to: error: unicode escape sequences cannot be used as a byte or in a byte string |
birkenfeld
added a commit
to birkenfeld/rust
that referenced
this issue
May 2, 2016
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
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
May 2, 2016
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
Manishearth
added a commit
to Manishearth/rust
that referenced
this issue
May 3, 2016
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Playpen: http://is.gd/DB2ZBU
Code like
b'→'
that puts a unicode character in a byte literal gets a confusing error message:A lot of people read this as if the part after the colon is in reference to "use a \xHH escape", so it should show an example of that, but it really is just displaying the char that is in error, though somewhat obfuscated by using the codepoint instead of the actual char.
The text was updated successfully, but these errors were encountered: