-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Closed
Copy link
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.
Description
I tried to compile the following code (playground):
const SPADE: char = '♠️';
For the avoidance of doubt, ♠️
is U+2660. I expected the code to compile—but instead, the literal is rejected:
error: character literal may only contain one codepoint
--> src/lib.rs:1:21
|
1 | const SPADE: char = '♠️';
| ^^^
|
help: if you meant to write a `str` literal, use double quotes
|
1 | const SPADE: char = "♠️";
| ^^^
Notably, it is accepted if unicode-escaped:
const SPADE: char = '\u{2660}';
Meta
rustc --version --verbose
:
rustc 1.57.0-nightly (e30b68353 2021-09-05)
binary: rustc
commit-hash: e30b68353fe22b00f40d021e7914eeb78473b3c1
commit-date: 2021-09-05
host: x86_64-apple-darwin
release: 1.57.0-nightly
LLVM version: 13.0.0
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Messages for errors, warnings, and lintsArea: Messages for errors, warnings, and lintsC-enhancementCategory: An issue proposing an enhancement or a PR with one.Category: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.Relevant to the compiler team, which will review and decide on the PR/issue.