Clarify emoji complexity in the characters (char) exercise

Aperta Adatta ai principianti
#2,453 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
1/5
Tempo stimato
Meno di un'ora
Idoneità per principianti
90/100
Tipo di issue
Documentazione
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
rust
Ambito
documentation

Direzione di ricerca

Il file da modificare è exercises/04_primitive_types/primitive_types2.rs. Cerca la riga di commento che invita a provare un emoji. Aggiornala per chiarire l'uso di un emoji semplice e avvertire degli emoji composti. Verifica eseguendo l'esercizio con rustlings run primitive_types2 per assicurarti che il commento venga compilato e che il messaggio sia chiaro.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Is your feature request related to a problem? Please describe.

While working on the characters (char) exercise, the instructions prompt the user to try an emoji:

// Try a letter, try a digit (in single quotes), try a special character, try a character from a different language than your own, try an emoji 😉

If a user tries a complex emoji like a heart on fire (❤️‍🔥) or a profession/gender-modified emoji, the compiler throws a character literal may only contain one codepoint error. This happens because these emojis are actually composed of multiple Unicode codepoints joined by Zero Width Joiners (ZWJ), which violates Rust's strict definition of a 4-byte single-codepoint char.

For beginners, this can be quite confusing since both 😉 and ❤️‍🔥 visually look like a single "character" in their text editor.

Describe the solution you'd like

I would like to update the comment in the exercise file to explicitly mention using a simple emoji (one that consists of a single codepoint) and briefly warn that composite emojis will cause a compilation error.

For example, updating the comment from:

// Try a letter, try a digit (in single quotes), try a special character, try a character
// from a different language than your own, try an emoji 😉

To something like:

// Try a letter, try a digit (in single quotes), try a special character, try a character
// from a different language than your own, try a simple emoji 😉 (avoid composite emojis 
// like ❤️‍🔥 which consist of multiple Unicode codepoints!)
Describe alternatives you've considered

An alternative would be leaving it as is, but it frequently catches learners off guard when they choose a modern, multi-codepoint emoji from their system picker.

Additional context

Tested on Rust stable. The issue stems from the fundamental difference between a Rust char (a single Unicode Scalar Value) and an extended grapheme cluster.

Source: Exercice
https://github.com/rust-lang/rustlings/blob/main/exercises/04_primitive_types/primitive_types2.rs

Cargo version: cargo 1.98.1 (797e8a9bc 2026-08-05)
Rustlings version: rustlings 6.5.0

ls -la

total 60
drwxrwxr-x  7 devminds devminds  4096 sept. 22 12:59 .
drwxrwxr-x  4 devminds devminds  4096 sept. 22 12:57 ..
-rw-rw-r--  1 devminds devminds   153 sept. 22 12:59 Cargo.lock
-rw-rw-r--  1 devminds devminds 14591 sept. 22 12:57 Cargo.toml
drwxrwxr-x 27 devminds devminds  4096 sept. 22 12:57 exercises
drwxrwxr-x  7 devminds devminds  4096 sept. 22 12:57 .git
-rw-rw-r--  1 devminds devminds    28 sept. 22 12:57 .gitignore
-rw-rw-r--  1 devminds devminds    88 sept. 22 12:57 rust-analyzer.toml
-rw-rw-r--  1 devminds devminds   210 sept. 22 19:32 .rustlings-state.txt
drwxrwxr-x 27 devminds devminds  4096 sept. 22 12:57 solutions
drwxrwxr-x  4 devminds devminds  4096 sept. 22 17:51 target
drwxrwxr-x  2 devminds devminds  4096 sept. 22 12:57 .vscode

OS

DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=24.04
DISTRIB_CODENAME=noble
DISTRIB_DESCRIPTION="Ubuntu 24.04.5 LTS"
PRETTY_NAME="Ubuntu 24.04.5 LTS"
NAME="Ubuntu"
VERSION_ID="24.04"
VERSION="24.04.5 LTS (Noble Numbat)"
VERSION_CODENAME=noble
ID=ubuntu
ID_LIKE=debian
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
UBUNTU_CODENAME=noble
LOGO=ubuntu-logo
Lingua principale
Rust
Stelle
64.6k
Fork
11.3k
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di rust-lang/rustlings

Tutte le issue di rust-lang/rustlings

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.