cargo add
can add dependencies from crate.io registry even when using vendor or different registry
#15019
Labels
A-directory-source
Area: directory sources (vendoring)
C-feature-request
Category: proposal for a feature. Before PR, ping rust-lang/cargo if this is not `Feature accepted`
Command-add
Command-vendor
S-triage
Status: This issue is waiting on initial triage.
cargo add
fuzzy searching replaces anything outside the directory with a package inside the directory #10729 (comment). However, it was actually not resolved or maybe there's some misunderstanding in the discussion so I create this issue to discuss this again.Problem
When I use
cargo vendor
and update the.cargo/config.toml
, I can not add new dependencies (which didn't exist before) to the project. The error I encounter isMy temporary solution for this is to manually add the dependency to
Cargo.toml
and runcargo vendor
, so that the dependency can be downloaded and added tovendor
.The problem (IMO) is that because I already changed the [source.crates-io] to
vendor-sources
, cargo will not look for dependencies incrate.io
registry anymore and use thevendor
folder instead. This is sadly quite unintuitive (and unconvenient as well) as everytime I want to add a new dependency, I need to manually adjust theCargo.toml
.Proposed Solution
I think the best option is that
cargo add
should automatically look for the dependency incrates.io
if it doesn't exist invendor
registry (or any registry rather than the default one), download it and update theCargo.toml
file. Then users can usecargo vendor
to add the new depedency tovendor
folder. It would be something likeNotes
Here's my
config.toml
And cargo version
The text was updated successfully, but these errors were encountered: