Description
Problem
Cargo passes over features one-by-one in CARGO_FEATURE_...
environment variables:
cargo/src/cargo/core/compiler/custom_build.rs
Lines 224 to 228 in 524231f
However, there's no way to get a list of all of these variables, without iterating over every environment variable.
I'd like to be able to display the list of enabled features in the version information, and right now that requires testing each variable (via #[cfg(feature=)]
).
Proposed Solution
A new environment variable ala CARGO_FEATURES
with a comma-separated list of enabled features would allow grabbing this information easily. (Comma-separated would match the --features
flag to cargo
)
Notes
One potential downside of this is that it adds redundant information, and might make it a bit worse for users invoking the toolchain directly without using the cargo
tool specifically.