Skip to content

Ch14.03 Unclear description of dependency versions across a workspace #3141

@tpdickson

Description

@tpdickson
  • I have checked the latest main branch to see if this has already been fixed
  • I have searched existing issues and pull requests for duplicates

URL to the section(s) of the book with this problem:
https://doc.rust-lang.org/stable/book/ch14-03-cargo-workspaces.html#depending-on-an-external-package-in-a-workspace

Description of the problem:
The book states that the top-level Cargo.lock file in a workspace ensures that all crates in the workspace use the same version of dependencies. It uses the crate rand as an example. It further states the same thing again, and that "no additional copies of rand will be downloaded." I've set the adder crate to use rand 0.7.3 and the add_one crate to use rand 0.8.3, then built the workspace. In my workspace's Cargo.lock file, there is now rand 0.7.3 and rand 0.8.5, and the output log on cargo build showed that it compiled the second version of rand.

Suggested fix:
The current text is either not clear enough to describe how dependency versioning is handled within a workspace, or the description is incorrect. I don't know what the correct behavior should be, but what I'm seeing from my workspace is contradicting what I'm reading in the book.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions