Open
Description
I was going thru Rustlings, and in primitive_types2.rs
it encourages you to use an Emoji for the character literal.
let // Finish this line like the example! What's your favorite character?
// Try a letter, try a number, try a special character, try a character
// from a different language than your own, try an emoji!
if your_character.is_alphabetic() {
println!("Alphabetical!");
} else if your_character.is_numeric() {
println!("Numerical!");
} else {
println!("Neither alphabetic nor numeric!");
}
I tried to use the emoji 1️⃣ (Keycap Digit One) as the character and it made rustc sad:
error: lifetimes cannot start with a number
--> exercises/primitive_types/primitive_types2.rs:19:26
|
19 | let your_character = '1️⃣';// Finish this line like the example! What's your favorite character?
| ^^
error: unknown start of token: \u{20e3}
--> exercises/primitive_types/primitive_types2.rs:19:29
|
19 | let your_character = '1️⃣';// Finish this line like the example! What's your favorite character?
| ^
error[E0762]: unterminated character literal
--> exercises/primitive_types/primitive_types2.rs:19:30
|
19 | let your_character = '1️⃣';// Finish this line like the example! What's your favorite character?
| ^^
The same kind of compiler errors can be produced with the following code:
fn main() {
println('1️⃣');
}
Rust version: rustc 1.59.0 (9d1b210 2022-02-23)