rust-lang / cargo

The Rust package manager
https://doc.rust-lang.org/cargo
Apache License 2.0
12.81k stars 2.43k forks source link

Highlight enables features in `cargo info` #14634

Open georgmu opened 1 month ago

georgmu commented 1 month ago

Problem

As described in #14141, the following thing should be displayed for features:

The enabled/disabled features are ignored in the cargo info output. There is always just a "+" for default features. Enabled features via Cargo.toml are not displayed as enabled.

Steps

$ grep "^reqwest =" Cargo.toml
reqwest = { version = "*", features = ["blocking", "json", "cookies", "rustls-tls-native-roots"], default-features = false }
$ cargo +nightly info reqwest
reqwest #http #request #client
higher level HTTP client library
version: 0.12.8
license: MIT OR Apache-2.0
rust-version: 1.63.0
documentation: https://docs.rs/reqwest
repository: https://github.com/seanmonstar/reqwest
crates.io: https://crates.io/crates/reqwest/0.12.8
features:
 +default                             = [default-tls, charset, http2, macos-system-configuration]
  __tls                               = [dep:rustls-pemfile, tokio/io-util]
  charset                             = [dep:encoding_rs]
  default-tls                         = [dep:hyper-tls, dep:native-tls-crate, __tls, dep:tokio-native-tls]
  h2                                  = [dep:h2]
  http2                               = [h2, hyper/http2, hyper-util/http2, hyper-rustls?/http2]
  macos-system-configuration          = [dep:system-configuration]
  25 deactivated features
note: to see how you depend on reqwest, run `cargo tree --invert --package reqwest@0.12.8`

Possible Solution(s)

No response

Notes

No response

Version

cargo 1.83.0-nightly (80d82ca22 2024-09-27) release: 1.83.0-nightly commit-hash: 80d82ca22abbee5fb7b51fa1abeb1ae34e99e88a commit-date: 2024-09-27 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: Fedora 41.0.0 (FortyOne) [64-bit]

epage commented 1 month ago

That was stale information and we've only been supporting default atm.

The question is which set of features to be considered enabled

And what should we do when the package isn't depended on by you?

georgmu commented 1 month ago

I have no experience with multiple workspace members, but here is what I expect:

(BTW: cargo add feature list is broken when using version="*" in Cargo.toml - I will open a separate ticket for this.)