Closed
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