-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
A-cfg-exprArea: Platform cfg expressionsArea: Platform cfg expressionsA-target-dependenciesArea: [target.'cfg(foo)'.dependencies]Area: [target.'cfg(foo)'.dependencies]C-bugCategory: bugCategory: bug
Description
Problem
According to the Cargo documentation:
Unlike in your Rust source code, you cannot use
[target.'cfg(feature = "my_crate")'.dependencies]to add dependencies based on optional crate features. Use the [features] section instead.
However, the tracing crates are apparently doing this successfully:
[target.'cfg(not(feature = "std"))'.dependencies]
spin = "0.5"
lazy_static = { version = "1", features = ["spin_no_std"] }
I would expect this to fail.
Possible Solution(s)
It's not clear to me whether the code or the documentation is correct.
I encountered this because I'm writing tools to process Cargo metadata which understands platform-specific dependencies, and it failed on encountering a dependency predicated on a feature. I'm not sure if I should implement support for that or not.
Notes
Output of cargo version:
cargo 1.37.0 (9edd089 2019-08-02)
Metadata
Metadata
Assignees
Labels
A-cfg-exprArea: Platform cfg expressionsArea: Platform cfg expressionsA-target-dependenciesArea: [target.'cfg(foo)'.dependencies]Area: [target.'cfg(foo)'.dependencies]C-bugCategory: bugCategory: bug