Closed
Description
Problem
When using cargo add
while vendored it 'autocorrects' the crate name, even for quite far string distances and for crates that are included in the vendored directory!
(I also think that the distance it corrects to, is too far for such a short string. Given that adding a crate to your Cargo.toml is quite consequential wrt to access rights, having an unknown one being installed is not ideal. Especially if not vendored.)
A quick demonstration:
✦ ❯ cargo add uuid --features v4,serde
warning: translating `uuid` to `nom`
Adding nom v7.1.3 to dependencies.
error: unrecognized features for crate nom: serde, v4
no features available for crate nom
✦ ❯ ls vendor/uuid/
Cargo.toml LICENSE-APACHE LICENSE-MIT README.md src
This confused me for a moment, when I then tried 'cargo update' it finally dawned on me that it was my vendoring of packages that caused this odd output.
Steps
- Vendor your dependencies (
cargo vendor
) - Update the
.cargo/
file - Run
cargo add
for a crate that exists
Possible Solution(s)
No response
Notes
No response
Version
✦ ❯ cargo version --verbose
cargo 1.75.0 (1d8b05cdd 2023-11-20)
release: 1.75.0
commit-hash: 1d8b05cdd1287c64467306cf3ca2c8ac60c11eb0
commit-date: 2023-11-20
host: x86_64-unknown-linux-gnu
libgit2: 1.7.1 (sys:0.18.1 vendored)
libcurl: 8.4.0-DEV (sys:0.4.68+curl-8.4.0 vendored ssl:OpenSSL/1.1.1u)
ssl: OpenSSL 1.1.1u 30 May 2023
os: NixOS 24.11.0 [64-bit]