Problem
This is the inverse of #14810.
Based on the design discussions and documentation of cargo info, it should use local Cargo.toml files when the current directory is a crate or workspace containing the specified crate. (Side-note: I would have expected that spec wouldn't be necessary when inside a single crate; is there a good reason for not making spec optional in that case?)
However, it always seems to use the default registry regardless of what my current directory is. In addition to not showing a local filepath, the behaviors I've observed are:
- If I add a feature locally, that feature is not listed.
- If I try to use
cargo info for a crate that is not published or is published in a non-default registry (without providing the --registry argument), the tool prints:
Updating crates.io index
error: could not find `<spec>` in registry `https://github.com/rust-lang/crates.io-index`
With --offline, the "Updating crates.io index" line is skipped, but I get the same behavior.
Update: this is apparently due to my use of .cargo/config.toml. See below.
Steps
- Create a local crate.
- Create
.cargo/config.toml that explicitly sets registry.default to crates-io.
- Run
cargo info <name>.
Possible Solution(s)
No response
Notes
No response
Version
cargo 1.89.0 (c24e10642 2025-06-23)
release: 1.89.0
commit-hash: c24e1064277fe51ab72011e2612e556ac56addf7
commit-date: 2025-06-23
host: aarch64-apple-darwin
libgit2: 1.9.0 (sys:0.20.2 vendored)
libcurl: 8.7.1 (sys:0.4.80+curl-8.12.1 system ssl:(SecureTransport) LibreSSL/3.3.6)
ssl: OpenSSL 3.5.0 8 Apr 2025
os: Mac OS 15.7.1 [64-bit]
Problem
This is the inverse of #14810.
Based on the design discussions and documentation of
cargo info, it should use localCargo.tomlfiles when the current directory is a crate or workspace containing the specified crate. (Side-note: I would have expected thatspecwouldn't be necessary when inside a single crate; is there a good reason for not makingspecoptional in that case?)However, it always seems to use the default registry regardless of what my current directory is. In addition to not showing a local filepath, the behaviors I've observed are:
cargo infofor a crate that is not published or is published in a non-default registry (without providing the--registryargument), the tool prints:With
--offline, the "Updating crates.io index" line is skipped, but I get the same behavior.Update: this is apparently due to my use of
.cargo/config.toml. See below.Steps
.cargo/config.tomlthat explicitly setsregistry.defaulttocrates-io.cargo info <name>.Possible Solution(s)
No response
Notes
No response
Version