Skip to content

Commit 12c107a

Browse files
committed
Auto merge of #8900 - ErichDonGubler:patch-1, r=alexcrichton
fix: we don't ignore `version` for `git`/`path` deps now Here's a sample invocation using Cargo 1.48 to prove this: ``` $ cargo new test-cargo-version-path-constraints && cd test-cargo-version-path-constraints Created binary (application) `test-cargo-version-path-constraints` package $ echo 'windows-service = { version = "999", git = "https://github.com/NZXTCorp/windows-service-rs" }' >> Cargo.toml $ cargo build Updating git repository `https://github.com/NZXTCorp/windows-service-rs` error: failed to select a version for the requirement `windows-service = "^999"` candidate versions found which didn't match: 0.3.2 location searched: Git repository https://github.com/NZXTCorp/windows-service-rs required by package `test-cargo-version-path-constraints v0.1.0 (C:\tools\msys64\home\erich\workspace\tmp\test-cargo-version-path-constraints)` ```
2 parents 9991af3 + 795dce1 commit 12c107a

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/doc/src/reference/specifying-dependencies.md

+5-3
Original file line numberDiff line numberDiff line change
@@ -205,9 +205,9 @@ hello_utils = { path = "hello_utils", version = "0.1.0" }
205205

206206
It is possible to specify both a registry version and a `git` or `path`
207207
location. The `git` or `path` dependency will be used locally (in which case
208-
the `version` is ignored), and when published to a registry like [crates.io],
209-
it will use the registry version. Other combinations are not allowed.
210-
Examples:
208+
the `version` is checked against the local copy), and when published to a
209+
registry like [crates.io], it will use the registry version. Other
210+
combinations are not allowed. Examples:
211211

212212
```toml
213213
[dependencies]
@@ -218,6 +218,8 @@ bitflags = { path = "my-bitflags", version = "1.0" }
218218
# Uses the given git repo when used locally, and uses
219219
# version 1.0 from crates.io when published.
220220
smallvec = { git = "https://github.com/servo/rust-smallvec", version = "1.0" }
221+
222+
# N.B. that if a version doesn't match, Cargo will fail to compile!
221223
```
222224

223225
One example where this can be useful is when you have split up a library into

0 commit comments

Comments
 (0)