Skip to content

Commit dfa0cbc

Browse files
committed
Clarify ambiguity about how to ask Cargo for a specific version
1 parent 4dda364 commit dfa0cbc

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/doc/book/guessing-game.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -357,9 +357,13 @@ Cargo uses the dependencies section to know what dependencies on external
357357
crates you have, and what versions you require. In this case, we’ve specified version `0.3.0`,
358358
which Cargo understands to be any release that’s compatible with this specific version.
359359
Cargo understands [Semantic Versioning][semver], which is a standard for writing version
360-
numbers. If we wanted to use only `0.3.0` exactly, we could use `=0.3.0`. If we
361-
wanted to use the latest version we could use `*`; We could use a range of
362-
versions. [Cargo’s documentation][cargodoc] contains more details.
360+
numbers. A bare number like above is actually shorthand for `^0.3.0`,
361+
meaning "anything compatible with 0.3.0".
362+
If we wanted to use only `0.3.0` exactly, we could say `rand="=0.3.0"`
363+
(note the two equal signs).
364+
And if we wanted to use the latest version we could use `*`.
365+
We could also use a range of versions.
366+
[Cargo’s documentation][cargodoc] contains more details.
363367

364368
[semver]: http://semver.org
365369
[cargodoc]: http://doc.crates.io/crates-io.html

0 commit comments

Comments
 (0)