← All open source projects

Rustlings

rust-lang/rustlings

Rustlings is a set of small exercises for learning to read and write Rust.

Forks 11,211
Author rust-lang
Language Rust
License MIT
Synced 2026-06-27

What it is

Rustlings is a set of short Rust exercises. It is commonly used alongside the official Rust book: the book explains ideas, while Rustlings makes learners fix small programs.

Rust is hard to learn by reading alone. Ownership, borrowing, types, pattern matching, and error handling need hands-on compiler feedback.

How exercises work

The exercises are intentionally small. A file contains almost-correct code that fails to compile or needs a small change. The learner reads the compiler message and fixes it.

This format makes errors part of learning. Rust compiler messages explain ownership, type mismatches, and explicit result handling.

Running exercises

This example shows the normal loop: install Rustlings, run it, and move through tasks until the compiler is happy.

Language: Bash
cargo install rustlings
rustlings init
cd rustlings
rustlings

What is inside

The repository includes exercises for variables, functions, conditionals, structs, enums, modules, collections, errors, iterators, and other core language pieces.

Rustlings is not a full textbook. It is a practice bridge between reading and building your own project.

Strengths

The main strength is short feedback. Learners see an error, change code, and check again, which fits a language where the compiler is a strong teacher.

It also lives close to the official Rust ecosystem and pairs well with official learning material.

Limits

Rustlings does not teach large application design. After the exercises, learners still need their own CLI, web service, parser, or library.

It should not become mechanical hint fixing. The goal is to understand why the compiler wanted the change.