The Rust Programming Language
Find a file
cake-duke 8c0eacd5c4
Some checks failed
CI / Run tests (push) Has been cancelled
CI / Run package tests (push) Has been cancelled
CI / Run lints (push) Has been cancelled
Update ch07-02-defining-modules-to-control-scope-and-privacy.md
2025-11-18 10:36:41 -05:00
.cargo Rename deprecated .cargo/config to .cargo/config.toml 2024-05-22 14:52:49 -04:00
.github Update to Rust 1.90 2025-10-27 21:41:51 -04:00
2018-edition Redirects: get rid of the weird gap in Ch. 20 sections! 2025-01-22 09:17:08 -07:00
ci Add urls to the dictionary 2025-10-18 21:13:33 -04:00
dot Ch. 17: create a diagram showing blocked parallelism 2024-10-07 13:34:57 -06:00
first-edition Redirects: get rid of the weird gap in Ch. 20 sections! 2025-01-22 09:17:08 -07:00
listings Update to Rust 1.90 2025-10-27 21:41:51 -04:00
nostarch Prepare for renaming of rust-lang/rust default branch 2025-10-20 10:01:39 -04:00
packages Prepare for renaming of rust-lang/rust default branch 2025-10-20 10:01:39 -04:00
redirects Prepare for renaming of rust-lang/rust default branch 2025-10-20 10:01:39 -04:00
second-edition Redirects: get rid of the weird gap in Ch. 20 sections! 2025-01-22 09:17:08 -07:00
src Update ch07-02-defining-modules-to-control-scope-and-privacy.md 2025-11-18 10:36:41 -05:00
theme Apply dprint fmt to active files in the repo 2024-12-02 16:09:20 -07:00
tools Fix path replacement in miri example 2025-07-29 20:34:33 -04:00
.git-blame-ignore-revs Fix .git-blame-ignore-revs file 2024-12-09 14:40:23 -07:00
.gitattributes Mark png as binary 2017-03-31 15:30:48 -04:00
.gitignore infra: ignore VS Code and Zed settings 2024-12-03 07:05:57 -07:00
ADMIN_TASKS.md Edition maintenance: scripting the updates for future work 2025-02-25 11:40:19 -07:00
book.toml use AND for search terms 2025-11-18 10:33:41 -05:00
Cargo.lock Edition maintenance: scripting the updates for future work 2025-02-25 11:40:19 -07:00
Cargo.toml Edition maintenance: scripting the updates for future work 2025-02-25 11:40:19 -07:00
CONTRIBUTING.md Update CONTRIBUTING.md 2025-10-18 21:23:45 -04:00
COPYRIGHT simplify COPYRIGHT file 2023-03-30 09:59:46 -04:00
dprint.jsonc infra: dprint fmt dprint config itself 2024-12-04 17:01:07 -07:00
ferris.css Ferris: always show Ferrises, even if small 2025-03-17 11:42:44 -06:00
ferris.js Ferris: simplify line counting for size determination 2025-03-17 11:41:09 -06:00
LICENSE-APACHE Update copyright in LICENSE-APACHE 2023-04-12 20:05:30 -04:00
LICENSE-MIT Work towards getting tidy clean 2017-03-13 13:51:36 -04:00
README.md Prepare for renaming of rust-lang/rust default branch 2025-10-20 10:01:39 -04:00
rust-toolchain Update to Rust 1.90 2025-10-27 21:41:51 -04:00
rustfmt.toml Add rustfmt to the update-rustc script 2020-01-25 21:20:41 -05:00
style-guide.md Apply dprint fmt to active files in the repo 2024-12-02 16:09:20 -07:00
TODO.md Messy snapshot of chapter 13 after copyedit check 2022-10-20 16:39:55 -04:00

The Rust Programming Language

Build Status

This repository contains the source of "The Rust Programming Language" book.

The book is available in dead-tree form from No Starch Press.

You can also read the book for free online. Please see the book as shipped with the latest stable, beta, or nightly Rust releases. Be aware that issues in those versions may have been fixed in this repository already, as those releases are updated less frequently.

See the releases to download just the code of all the code listings that appear in the book.

Requirements

Building the book requires mdBook, ideally the same version that rust-lang/rust uses in this file. To get it:

$ cargo install mdbook --locked --version <version_num>

The book also uses two mdbook plugins which are part of this repository. If you do not install them, you will see warnings when building and the output will not look right, but you will still be able to build the book. To use the plugins, you should run:

$ cargo install --locked --path packages/mdbook-trpl --force

Building

To build the book, type:

$ mdbook build

The output will be in the book subdirectory. To check it out, open it in your web browser.

Firefox:

$ firefox book/index.html                       # Linux
$ open -a "Firefox" book/index.html             # OS X
$ Start-Process "firefox.exe" .\book\index.html # Windows (PowerShell)
$ start firefox.exe .\book\index.html           # Windows (Cmd)

Chrome:

$ google-chrome book/index.html                 # Linux
$ open -a "Google Chrome" book/index.html       # OS X
$ Start-Process "chrome.exe" .\book\index.html  # Windows (PowerShell)
$ start chrome.exe .\book\index.html            # Windows (Cmd)

To run the tests:

$ cd packages/trpl
$ mdbook test --library-path packages/trpl/target/debug/deps

Contributing

We'd love your help! Please see CONTRIBUTING.md to learn about the kinds of contributions we're looking for.

Because the book is printed, and because we want to keep the online version of the book close to the print version when possible, it may take longer than you're used to for us to address your issue or pull request.

So far, we've been doing a larger revision to coincide with Rust Editions. Between those larger revisions, we will only be correcting errors. If your issue or pull request isn't strictly fixing an error, it might sit until the next time that we're working on a large revision: expect on the order of months or years. Thank you for your patience!

Translations

We'd love help translating the book! See the Translations label to join in efforts that are currently in progress. Open a new issue to start working on a new language! We're waiting on mdbook support for multiple languages before we merge any in, but feel free to start!

Spellchecking

To scan source files for spelling errors, you can use the spellcheck.sh script available in the ci directory. It needs a dictionary of valid words, which is provided in ci/dictionary.txt. If the script produces a false positive (say, you used the word BTreeMap which the script considers invalid), you need to add this word to ci/dictionary.txt (keep the sorted order for consistency).