Open
Description
If you try to compile this:
fn main() {
let bytes = b"ñ";
}
You'll get:
error: non-ASCII character in byte string literal
--> src/main.rs:2:19
|
2 | let bytes = b"ñ";
| ^ must be ASCII
|
help: if you meant to use the unicode code point for 'ñ', use a \xHH escape
|
2 | let bytes = b"\xF1";
| ~~~~
This is an unhelpful suggestion, because that's not a correct unicode encoding for 'ñ' (in utf-8, it would be "\xC3\xB1", and in utf-16 it would be "\x00\xF1").
Meta
rustc --version --verbose
: This reproduces on https://play.rust-lang.org with both stable and nightly (although the output is a bit different on nightly)
Backtrace