book icon indicating copy to clipboard operation
book copied to clipboard

Perhaps the 1st chapter in the cargo should mention quickly what a [workspace] is? And perhaps include this tag with cargo new?

Open abmpicoli opened this issue 2 years ago • 0 comments
trafficstars

  • I have searched open and closed issues and pull requests for duplicates, using these search terms:
    • workspace
  • I have checked the latest main branch to see if this has already been fixed, in this file:
    • I have just read the https://rust-book.cs.brown.edu and the "issue" is still there, he comment.

URL to the section(s) of the book with this problem: https://rust-book.cs.brown.edu/ch01-03-hello-cargo.html

Description of the problem:

One of the problems I've found as I've progressed in the rust book was a surprise regarding the way workspaces are evaluated:

cargo tries to find the earliest cargo.toml file that has a [workspace] tag in the hierarchy. This ended up generating an issue, that is discussed in the https://users.rust-lang.org/t/what-is-the-correlation-between-two-cargo-toml-in-the-file-hierarchy/101933/11 forum:

Suggested fix:

My suggestion for cargo would be that cargo new should generate a [workspace] tag by default.

My suggestion for this book should be that the [workspace] tag would have at least an early explanation:

My early suggestion for the chapter itself: "The [workspace] tag specifies that the project is independent, instead of a part of a larger project."

abmpicoli avatar Nov 18 '23 15:11 abmpicoli