diff options
| author | Steve Klabnik <steve@steveklabnik.com> | 2015-12-01 19:01:41 -0500 |
|---|---|---|
| committer | Steve Klabnik <steve@steveklabnik.com> | 2015-12-01 19:01:41 -0500 |
| commit | da095eecc7518cfc763a869f197fb21dec525194 (patch) | |
| tree | 3a323430fb67aa9a897450acdec23fd90eceb12d | |
| parent | 8fd7f1e614b2b28245ece592def4916d147a7729 (diff) | |
| parent | dfa0cbcb3e44c440c842d8990d6be85911964aba (diff) | |
| download | rust-da095eecc7518cfc763a869f197fb21dec525194.tar.gz rust-da095eecc7518cfc763a869f197fb21dec525194.zip | |
Rollup merge of #30144 - pjungwir:clarify-semver-rules, r=steveklabnik
The documentation shows this:
[dependencies]
rand="0.3.0"
and says it allows any version compatible with 0.3.0, but then it says, "If we wanted to use only 0.3.0 exactly, we could use `=0.3.0`." That is very easy to misunderstand, so hopefully this PR will help others not to be as confused as me. :-)
| -rw-r--r-- | src/doc/book/guessing-game.md | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/doc/book/guessing-game.md b/src/doc/book/guessing-game.md index ef829c65558..0f9bc80af98 100644 --- a/src/doc/book/guessing-game.md +++ b/src/doc/book/guessing-game.md @@ -357,9 +357,13 @@ Cargo uses the dependencies section to know what dependencies on external crates you have, and what versions you require. In this case, we’ve specified version `0.3.0`, which Cargo understands to be any release that’s compatible with this specific version. Cargo understands [Semantic Versioning][semver], which is a standard for writing version -numbers. If we wanted to use only `0.3.0` exactly, we could use `=0.3.0`. If we -wanted to use the latest version we could use `*`; We could use a range of -versions. [Cargo’s documentation][cargodoc] contains more details. +numbers. A bare number like above is actually shorthand for `^0.3.0`, +meaning "anything compatible with 0.3.0". +If we wanted to use only `0.3.0` exactly, we could say `rand="=0.3.0"` +(note the two equal signs). +And if we wanted to use the latest version we could use `*`. +We could also use a range of versions. +[Cargo’s documentation][cargodoc] contains more details. [semver]: http://semver.org [cargodoc]: http://doc.crates.io/crates-io.html |
