Skip to content

Commit 0f544d2

Browse files
committed
fix: Include git with version.from
1 parent 072c5e7 commit 0f544d2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

text/3516-public-private-dependencies.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,19 +361,19 @@ One possible approach for this:
361361
name = "some-cli"
362362

363363
[dependencies]
364-
clap = { version.from ["clap_complete", "clap_mangen"] }
364+
clap = { from = ["clap_complete", "clap_mangen"] }
365365
clap_complete = "3.4"
366366
clap_mangen = "3.4"
367367
```
368368
When resolving the dependencies for `some-cli`,
369369
the resolver will not explicitly choose a version for `clap` but will continue resolving the graph.
370-
Upon completion, it will look to see what version of `clap_complete` was
370+
Upon completion, it will look to see what instance of `clap_complete` was
371371
resolved and act as if that was what was specified inside of the in-memory
372372
`clap` dependency.
373373

374-
The packakge using `version.from` must be a public dependency of the `from` package.
374+
The packakge using `from` must be a public dependency of the `from` package.
375375
In this case, `clap` must be a public dependency of `clap_complete`.
376-
If the different packages in `version.from` do not agree on what the package
376+
If the different packages in `from` do not agree on what the package
377377
version should resolve to (clap 3.4 vs clap 4.0), then it is an error.
378378

379379
Compared to the resolver doing this implicitly
@@ -385,6 +385,9 @@ The downside is it feels like the declaration is backwards.
385385
If you have one core crate (e.g. `clap`) and many crates branching off (e.g. `clap_complete`, `clap_mangen`),
386386
it seems like those helper crates should have their version picked from `clap`.
387387

388+
Whether this should be specified across all sources (`from`) or per source (`registry.from`, `git.from`, `path.from`) will need to be worked out.
389+
See [rust-lang/cargo#6921](https://github.com/rust-lang/cargo/issues/6921) for an example of using this for git dependencies.
390+
388391
## Missing feature declaration check
389392

390393
It is easy for packages to accidentally rely on a dependency enabling a feature for them.

0 commit comments

Comments
 (0)