Closed
Description
Rust currently doesn't support emojis for variable names. Is there any plans to include this feature?
➜ servo git:(mime-sniffing-one-sniffertask) ✗ ./mach build
Compiling net v0.0.1 (file:///Users/kparaju/Documents/repos/servo)
resource_task.rs:224:13: 224:14 error: unknown start of token: \U0001f443
resource_task.rs:224 let 👃 = sniffer_task::new_sniffer_task();
^
Could not compile `net`.
Metadata
Metadata
Assignees
Type
Projects
Milestone
Relationships
Development
No branches or pull requests
Activity
bstrie commentedon Nov 15, 2014
Sadly, at this time Rust only intends to support the subset of emotions that can be derived from UAX 31, and only then by employing a feature flag. You'll have to put some effort into your emoji, I'm afraid. For example:
Post 1.0 I expect that we can consider expanding the definition of what is permitted within Unicode identifiers, though it would have to proceed through the RFC process.
LenaWil commentedon Nov 21, 2019
Related RFC for those getting here through Google: #55467.
Artoria2e5 commentedon Apr 21, 2021
I am of the opinion that this issue should be reopened in light of the RFC being stabilized. As the friendly C++ folks noted on their report about adopting UAX #31 for C++:
The same 💩 emoji is rejected by rust precisely due to UAX-31, and arguably it makes stuff less fun than what Swift allows :Q (On the other hand, it does render the point about emoji width calculation on the RFC moot!)
flipbit03 commentedon Mar 9, 2024
I don't see the issue with emoji or any unicode identifiers. It's just a code point after all.
Merge pull request rust-lang#18982 from Veykril/push-lstmvzsowxyt