Skip to content

Commit 0bcde15

Browse files
authored
Merge pull request #3890 from rust-lang/push-vmxrspyskulq
Ch. 14: clarify workspace dependency reuse
2 parents 50149d9 + 1221096 commit 0bcde15

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/ch14-03-cargo-workspaces.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,10 +267,15 @@ error[E0432]: unresolved import `rand`
267267
To fix this, edit the *Cargo.toml* file for the `adder` package and indicate
268268
that `rand` is a dependency for it as well. Building the `adder` package will
269269
add `rand` to the list of dependencies for `adder` in *Cargo.lock*, but no
270-
additional copies of `rand` will be downloaded. Cargo has ensured that every
270+
additional copies of `rand` will be downloaded. Cargo will ensure that every
271271
crate in every package in the workspace using the `rand` package will be using
272-
the same version, saving us space and ensuring that the crates in the workspace
273-
will be compatible with each other.
272+
the same version as long as they specify compatible versions of `rand`, saving
273+
us space and ensuring that the crates in the workspace will be compatible with
274+
each other.
275+
276+
If crates in the workspace specify incompatible versions of the same dependency,
277+
Cargo will resolve each of them, but will still try to resolve as few versions
278+
as possible.
274279

275280
#### Adding a Test to a Workspace
276281

0 commit comments

Comments
 (0)