Open
Description
Problem
cargo add
is unable to add crates when told to use a registry that is a local or directory registry.
Steps
cargo new --lib foo && cd foo
cargo add libc
cargo check
mkdir .cargo
cargo local-registry -s Cargo.lock local-registry > .cargo/config.toml
sed '/itoa/d' Cargo.toml
cargo add --registry local-registry itoa
Produces
error: no index found for registry: `local-registry`
Alternatively, if registry.default
is set to local-registry
in .cargo/config.toml
, the same error occurs without passing --registry local-registry
.
Possible Solution(s)
cargo add --registry foo bar
should (assuming that bar
exists in the registry foo
) add
bar = { version = "...", registry = "foo" }
to Cargo.toml
.
Ideally, I think if there's a source replacement of crates-io
to foo
, cargo add
should be smart enough to realize the registry = "foo"
part should not be necessary.
Notes
No response
Version
cargo 1.62.1 (a748cf5a3 2022-06-08)
release: 1.62.1
commit-hash: a748cf5a3e666bc2dcdf54f37adef8ef22196452
commit-date: 2022-06-08
host: aarch64-unknown-linux-gnu
libgit2: 1.4.2 (sys:0.14.2 vendored)
libcurl: 7.80.0-DEV (sys:0.4.51+curl-7.80.0 vendored ssl:OpenSSL/1.1.1n)
os: Amazon Linux AMI 2.0.0 [64-bit]