Skip to content

ch01: add cargo fetch to the working-offline setup steps - #4820

Open
okxint wants to merge 1 commit into
rust-lang:mainfrom
okxint:fix/cargo-fetch-for-offline-use
Open

ch01: add cargo fetch to the working-offline setup steps#4820
okxint wants to merge 1 commit into
rust-lang:mainfrom
okxint:fix/cargo-fetch-for-offline-use

Conversation

@okxint

@okxint okxint commented Aug 30, 2026

Copy link
Copy Markdown

Summary

The "Working Offline with This Book" section instructs readers to run cargo add rand@0.10.1 trpl@0.2.0 to cache dependencies, but cargo add only updates Cargo.toml and Cargo.lock — it does not download the .crate archives. As a result, subsequent cargo commands with --offline fail because the crate files are not present in the local registry.

Fixes #4817.

Changes

  • Add cargo fetch as a fourth step after cargo add, which downloads and caches the .crate files locally
  • Update the prose from "Once you have run this command" → "Once you have run these commands" (plural)
  • Update "If you have run this command" → "If you have run these commands" (plural)
  • Fix "This will cache the downloads" → "This will download and cache the packages" for accuracy

`cargo add` only updates Cargo.toml / Cargo.lock; it does not download
the crate archives. Without a subsequent fetch or build, `--offline`
fails with "attempting to make an HTTP request".

Add `cargo fetch` as a fourth step so readers actually cache the
.crate files before going offline, and update the surrounding prose to
match (plural "these commands", "download and cache" instead of
"cache the downloads").

Fixes rust-lang#4817
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

the BOOK Ch. 1.1 Installation, "Working Offline": cargo add does not download crates, so --offline fails

1 participant