book icon indicating copy to clipboard operation
book copied to clipboard

Chapter 14.3, "Cargo Workspaces" → "Creating a Workspace" https://doc.rust-lang.org/nightly/book/ch14-03-cargo-workspaces.html#creating-a-workspace

Open HinataDeveloper opened this issue 2 weeks ago • 1 comments

Location

Chapter 14.3, "Cargo Workspaces" → "Creating a Workspace" https://doc.rust-lang.org/nightly/book/ch14-03-cargo-workspaces.html#creating-a-workspace

Observed in the nightly version of the book, as it appears alongside Rust 1.99.1 (released 2026-10-15).

Problem

The section begins with two shell commands:

$ mkdir add
$ cd add

and then says:

Next, in the add directory, we create the Cargo.toml file that will configure the entire workspace. This file won't have a [package] section.

Up to this point in the book, every step the reader has performed has been a command typed into the terminal (cargo new, cargo build, cargo run, and so on). A reader who follows the book step by step, and does exactly what it says, may reasonably read this passage as describing something a tool does for them.

Two things reinforce that reading:

  1. The sentence "This file won't have a [package] section" is declarative, not imperative. It reads like a description of generated output rather than an instruction to the reader.
  2. Cargo is introduced as a tool that scaffolds projects, so it is natural to assume it also scaffolds the workspace root, especially since no command is shown for that step.

In fact, no Cargo command creates a virtual workspace manifest. cargo new and cargo init both generate a [package] section. The reader must create this file by hand, but the text never says so explicitly. It leaves the reader to infer it.

Suggested change

State explicitly that this file is created manually, and phrase the [package] rule as an instruction. For example:

Next, in the add directory, create a file named Cargo.toml using your text editor. This file configures the entire workspace, so it must not contain a [package] section. Instead, it starts with a [workspace] section, which allows us to add members to the workspace.

Optionally, add a short note that there is no cargo command for creating this file, because cargo new and cargo init always produce a [package] section.

Why this matters

Learners who follow the book literally, which is the intended use, should not have to guess whether a step is manual or automated. A single explicit sentence removes the ambiguity at almost no cost.

HinataDeveloper avatar Nov 16 '26 12:11 HinataDeveloper

Up to this point in the book, every step the reader has performed has been a command typed into the terminal (cargo new, cargo build, cargo run, and so on).

This is not the case; in Chapter 1, we create files manually. I don't think this change is necessary.

carols10cents avatar Nov 18 '26 21:11 carols10cents