-
Notifications
You must be signed in to change notification settings - Fork 13.3k
four-byte uncode characters confuse '
#28851
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Aren't |
@arielb1 yes. am I doing something wrong here? I am bad at encodings, so this is likely. |
Unicode scalar value != character. |
Yes, but it's four bytes, no? |
Ahhh this isn't actually four bytes. Sigh. Thanks. |
(basically, I thought that those four things were four bytes, but they're four codepoints themselves) |
Actually, I am re-opening, because this diagnostic message is really bad. It should say that you're putting something that's larger than a single USV into a char literal. |
If you try to put something that's bigger than a char into a char literal, you get an error: fn main() { let c = 'ஶ்ரீ'; } error: unterminated character constant: This is a very compiler-centric message. Yes, it's technically 'unterminated', but that's not what you, the user did wrong. Instead, this commit changes it to error: character literal may only contain one codepoint As this actually tells you what went wrong. Fixes rust-lang#28851
If you try to put something that's bigger than a char into a char literal, you get an error: fn main() { let c = 'ஶ்ரீ'; } error: unterminated character constant: This is a very compiler-centric message. Yes, it's technically 'unterminated', but that's not what you, the user did wrong. Instead, this commit changes it to error: character literal that's larger than a char: As this actually tells you what went wrong. Fixes #28851
This Rust program:
contains
TAMIL SYLLABLE SHRII (śrī)
, akaU+0BB6 U+0BCD U+0BB0 U+0BC0
. When trying to compile this program, I get this error:I know that it isn't a copy-paste issue, because I used vim's
C-V u
to type in the four code points manually.The text was updated successfully, but these errors were encountered: