Memory safety without a garbage collector

Rust

Rust is a compiled systems language whose compiler enforces ownership and borrowing rules at build time, so whole classes of memory and data-race bugs are rejected before a program ever runs. It is used for command-line tools, network services, embedded firmware and WebAssembly. This curriculum starts with syntax, variables, types, control flow and functions; the intermediate lessons cover ownership, structs, enums and pattern matching, which is where Rust differs most from other languages; the advanced lessons put collections, iterators, Result and Option to work. Every example is compiled and run with rustc 1.94 (edition 2021), and every exercise is checked against real tests.

ChallengingExamples verified with rustc 1.94
lessons
5 lessons
exercises
13 exercises
interview questions
12 interview questions

What Rust is used for

  • Systems programming
  • WebAssembly
  • Command-line tools
  • Backends that need speed

How examples are checked

Every example and every exercise solution was run with rustc 1.94 at build time. In-browser execution for Rust is not available yet; the pages say so rather than pretending.

Learn

The Rust learning path

Read in order: each lesson leans only on the ones before it. Every lesson ends with a small program to write and links to matching exercises.

See the full curriculum with descriptions →

Practice

Practise Rust

13 exercises across 10 topics, each checked by running your program against test cases. Start with these:

All Rust exercises

More

Go further