Skip to content

Discrepancy in dependency specification with multiple locations #13279

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
fuzzypixelz opened this issue Jan 10, 2024 · 3 comments
Closed

Discrepancy in dependency specification with multiple locations #13279

fuzzypixelz opened this issue Jan 10, 2024 · 3 comments
Labels
A-crate-dependencies Area: [dependencies] of any kind C-bug Category: bug S-triage Status: This issue is waiting on initial triage.

Comments

@fuzzypixelz
Copy link

Problem

In the Cargo manifest, you can specify a dependency as a path/git and a version (See Multiple locations). Naturally, when specifying path+version you can add the registry used to pull the dep when publishing. But when using git+version you can't specify a registry; cargo reports the following:

dependency [..] specification is ambiguous. Only one of `git` or `registry` is allowed.

The aforementioned docs state:

The git or path dependency will be used locally (in which case the version is checked against the local copy), and when published to a registry like crates.io, it will use the registry version. Other combinations are not allowed.

Maybe this is a wording issue in docs, but I read "when published to a registry like crates.io" as "you can specify a registry here". After all, why does it make sense for path dependencies but not git dependencies? Unless it's referring to Source replacement, in which case the phrasing is arguable misleading.

Steps

  1. Create a crate with a dependency of the form dep = { version = "...", git = "...", registry = "..." }
  2. Run cargo check

Possible Solution(s)

Allow specifying an alternative registry when using git+version locations.

Notes

No response

Version

cargo 1.72.0 (103a7ff2e 2023-08-15)
release: 1.72.0
commit-hash: 103a7ff2ee7678d34f34d778614c5eb2525ae9de
commit-date: 2023-08-15
host: aarch64-apple-darwin
libgit2: 1.6.4 (sys:0.17.2 vendored)
libcurl: 8.1.2 (sys:0.4.63+curl-8.1.2 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 1.1.1u  30 May 2023
os: Mac OS 13.6.0 [64-bit]
@fuzzypixelz fuzzypixelz added C-bug Category: bug S-triage Status: This issue is waiting on initial triage. labels Jan 10, 2024
@epage epage added the A-crate-dependencies Area: [dependencies] of any kind label Jan 10, 2024
@epage
Copy link
Contributor

epage commented Jan 10, 2024

This looks to be a duplicate of #10875, closing in favor of that. If there is something distinct enough about this that we should re-open, let us know!

@epage epage closed this as not planned Won't fix, can't repro, duplicate, stale Jan 10, 2024
@fuzzypixelz
Copy link
Author

@epage I think this should be marked as a bug; or at the very least, the documentation is misleading. The other issue was treated as a feature request. Maybe close the other one in favor of this one? Or leave them both open and discuss whether it's a bug or an incomplete feature?

@epage
Copy link
Contributor

epage commented Jan 10, 2024

imo that can all happen on one issue and I'd prefer to keep the issue with more discussion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-crate-dependencies Area: [dependencies] of any kind C-bug Category: bug S-triage Status: This issue is waiting on initial triage.
Projects
None yet
Development

No branches or pull requests

2 participants