@@ -53,12 +53,14 @@ and `x > 0`.
53
53
It is possible to further tweak the logic for selecting compatible versions
54
54
using special operators, though it shouldn't be necessary most of the time.
55
55
56
- ### Caret requirements
56
+ ### Version requirement syntax
57
+
58
+ #### Caret requirements
57
59
58
60
** Caret requirements** are an alternative syntax for the default strategy,
59
61
` ^1.2.3 ` is exactly equivalent to ` 1.2.3 ` .
60
62
61
- ### Tilde requirements
63
+ #### Tilde requirements
62
64
63
65
** Tilde requirements** specify a minimal version with some ability to update.
64
66
If you specify a major, minor, and patch version or only a major and minor
@@ -73,7 +75,7 @@ version, then minor- and patch-level changes are allowed.
73
75
~1 := >=1.0.0, <2.0.0
74
76
```
75
77
76
- ### Wildcard requirements
78
+ #### Wildcard requirements
77
79
78
80
** Wildcard requirements** allow for any version where the wildcard is
79
81
positioned.
@@ -88,7 +90,7 @@ positioned.
88
90
89
91
> ** Note** : [ crates.io] does not allow bare ` * ` versions.
90
92
91
- ### Comparison requirements
93
+ #### Comparison requirements
92
94
93
95
** Comparison requirements** allow manually specifying a version range or an
94
96
exact version to depend on.
@@ -102,7 +104,7 @@ Here are some examples of comparison requirements:
102
104
= 1.2.3
103
105
```
104
106
105
- ### Multiple requirements
107
+ #### Multiple version requirements
106
108
107
109
As shown in the examples above, multiple version requirements can be
108
110
separated with a comma, e.g., ` >= 1.2, < 1.5 ` .
@@ -157,7 +159,7 @@ some-crate = { version = "1.0", registry = "my-registry" }
157
159
```
158
160
159
161
> ** Note** : [ crates.io] does not allow packages to be published with
160
- > dependencies on other registries .
162
+ > dependencies on code published outside of [ crates.io ] .
161
163
162
164
[ registries documentation ] : registries.md
163
165
@@ -202,9 +204,20 @@ once the lock is in place. However, they can be pulled down manually with
202
204
203
205
See [ Git Authentication] for help with git authentication for private repos.
204
206
205
- > ** Note** : [ crates.io] does not allow packages to be published with ` git `
206
- > dependencies (` git ` [ dev-dependencies] are ignored). See the [ Multiple
207
- > locations] ( #multiple-locations ) section for a fallback alternative.
207
+ > ** Note** : Neither the ` git ` key nor the ` path ` key changes the meaning of the
208
+ > ` version ` key: the ` version ` key always implies that the package is available
209
+ > in a registry. ` version ` , ` git ` , and ` path ` keys are considered [ separate
210
+ > locations] ( #multiple-locations ) for resolving the dependency.
211
+ >
212
+ > When the dependency is retrieved from ` git ` , the ` version ` key will _ not_
213
+ > affect which commit is used, but the version information in the dependency's
214
+ > ` Cargo.toml ` file will still be validated against the ` version ` requirement.
215
+
216
+ > ** Note** : [ crates.io] does not allow packages to be published with
217
+ > dependencies on code published outside of [ crates.io] itself
218
+ > ([ dev-dependencies] are ignored). See the [ Multiple
219
+ > locations] ( #multiple-locations ) section for a fallback alternative for ` git `
220
+ > and ` path ` dependencies.
208
221
209
222
[ Git Authentication ] : ../appendix/git-authentication.md
210
223
@@ -245,9 +258,16 @@ and specify its version in the dependencies line as well:
245
258
hello_utils = { path = " hello_utils" , version = " 0.1.0" }
246
259
```
247
260
248
- > ** Note** : [ crates.io] does not allow packages to be published with ` path `
249
- > dependencies (` path ` [ dev-dependencies] are ignored). See the [ Multiple
250
- > locations] ( #multiple-locations ) section for a fallback alternative.
261
+ > ** Note** : Neither the ` git ` key nor the ` path ` key changes the meaning of the
262
+ > ` version ` key: the ` version ` key always implies that the package is available
263
+ > in a registry. ` version ` , ` git ` , and ` path ` keys are considered [ separate
264
+ > locations] ( #multiple-locations ) for resolving the dependency.
265
+
266
+ > ** Note** : [ crates.io] does not allow packages to be published with
267
+ > dependencies on code published outside of [ crates.io] itself
268
+ > ([ dev-dependencies] are ignored). See the [ Multiple
269
+ > locations] ( #multiple-locations ) section for a fallback alternative for ` git `
270
+ > and ` path ` dependencies.
251
271
252
272
### Multiple locations
253
273
0 commit comments