Closed
Description
Problem
I naively expected that cargo info
would always show information from crates.io (as its documentation suggests). However, it seems that cargo info foo-bar
would not show information from crates.io if running from the directory of crate foo-bar
itself. One has to explicitly pass --registry=crates-io
to obtain information from crates.io.
Steps
- Go to some directory with a
Cargo.toml
file. - Run
cargo info foo-bar
(wherefoo-bar
is thepackage.name
value in theCargo.toml
file).
Expected: It will contact crates.io and show information from there.
Actual: It reads and show information from the local crate.
Possible Solution(s)
Either update the documentation to mention that local crate is favored. Or always fetch from crates.io.
Notes
cargo help info
shows:
NAME
cargo-info — Display information about a package in the registry. Default registry is crates.io
DESCRIPTION
This command displays information about a package in the registry. It fetches data from the package’s
Cargo.toml file and presents it in a human-readable format.
It mentions things like package
(something published on crates.io) and crates.io
. It doesn't say that it will read the local file system.
Version
cargo 1.84.0-nightly (e75214ea4 2024-10-25)
release: 1.84.0-nightly
commit-hash: e75214ea4936d2f2c909a71a1237042cc0e14b07
commit-date: 2024-10-25
host: x86_64-unknown-linux-gnu
libgit2: 1.8.1 (sys:0.19.0 vendored)
libcurl: 8.9.0-DEV (sys:0.4.74+curl-8.9.0 vendored ssl:OpenSSL/1.1.1w)
ssl: OpenSSL 1.1.1w 11 Sep 2023
os: Debian n/a (rodete) [64-bit]