Clarify emoji complexity in the characters (char) exercise

Open Beginner friendly
#2,453 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
1/5
Estimated time
Under an hour
Newbie friendliness
90/100
Issue type
Documentation
Clarity
Clearly specified
Activity status
Active
Tech stack
rust
Domain
documentation

Research direction

The file to edit is exercises/04_primitive_types/primitive_types2.rs. Look for the comment line that prompts trying an emoji. Update it to clarify using a simple emoji and warn about composite emojis. Verify by running the exercise with rustlings run primitive_types2 to ensure the comment compiles and the message is clear.

Written by the indexing model from the issue text.

Description

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
Dominant language
Rust
Stars
64.6k
Forks
11.3k
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from rust-lang/rustlings

All issues in rust-lang/rustlings

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.