Before you start
Setup
You cannot learn to read Rust deeply without running a compiler. Reading alone produces exactly the fluency illusion this course is built to prevent.
A toolchain, a scratch crate, and the habit of checking predictions against rustc rather than against your intuition. Everything else on this page is optional.
You can get started without installing anything: every self-contained snippet in the course has a Run button that compiles it on the official Rust Playground and shows you the real compiler output. Install the toolchain anyway β you will want to modify things, and the Playground is someone else's server.
Toolchain
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | shThen check it, and make a scratch crate you will use constantly:
rustc --version
cargo new scratch && cd scratch
cargo runKeep scratch open in an editor for the whole course. Every Predict box on this site is a thing you should paste in and run. The compiler is the oracle β that is the entire method.
Editor
Use rust-analyzer. It is not optional for reading unfamiliar code: go-to-definition and inlay type hints are the difference between decoding generic code and reading it.
- VS Code β the
rust-analyzerextension. Turn inlay hints on. - JetBrains β RustRover, or the Rust plugin.
- Neovim / Helix β rust-analyzer over LSP.
The commands you will actually use
| Command | What it is for |
|---|---|
cargo check | Type-check without generating code. Much faster than build; what you want while iterating. |
cargo clippy | The linter. Around 700 lints, many of which teach idiom rather than catch bugs. |
rustc --explain E0502 | Underused. A full explanation of any error code, with examples. |
cargo doc --open | Local docs for your project and every dependency, at your exact versions. |
cargo tree -i <crate> | Why is this dependency here? Inverts the tree to show who pulled it in. |
cargo expand | See through macros and derives. Install with cargo install cargo-expand. |
cargo bloat | Which generics produced the most binary. Makes monomorphisation concrete. |
cargo +nightly miri test | Detect undefined behaviour in unsafe code at run time. |
Reading tools
This course is about reading, so these matter more here than in most Rust material.
- std documentationβ every page has a source link. Click it. The standard library is unusually readable and it is the best Rust you can study.
- docs.rsβ every published crate, every version, also with source links.
- lib.rsβ ranks crates by real usage and shows maintenance status. Better than crates.io for judging whether to depend on something.
- The Playgroundβ this site calls its API directly, so Run executes your snippet there and prints the result inline. βEdit in Playgroundβ opens the same code for you to modify. Also the standard way to share a reproducible example when asking for help.
- The error indexβ every error code with an explanation. A curriculum in disguise, and almost nobody is told it exists.
- Compiler Explorerβ see the actual assembly. The fastest way to settle a "is this really zero-cost?" argument.
Edition
Use the 2024 edition β it is what cargo newgives you on a current toolchain, and it is what the Playground links on this site use. Editions are opt-in language dialects; crates on different editions interoperate fine, so this is a per-crate choice with no ecosystem cost.
When a Predict box asks whether something compiles and you arecertain, that is exactly when to hit Run. Certainty is where the wrong models hide, and it is whatCalibration is measuring. Commit your answer first, though β reading the output before predicting turns the best tool on this site into a spoiler.
Ready? Start with0.1 β Why you will feel stupid.