Description
Problem
If you have multiple [[targets]]
It can be pretty exhausting to manually juggle with the individual deviating --features sets at CLI under [[target]]
Especially as --all-features does not take into account / resolve the dependency features which in turn overrides explicit --features [another issue]
There was a previous issue and stale PR to trigger dependency features under [[target]]
#1570
#2325
But required-features was decided instead
#3667
And without separating things into workspaces relying on --features
can become big hurdlesome list.
Proposed Solution
Option 0 - Do nothing or Status Quo
Yes I could make for example feature-relay hack say under the package
[features]
example-features = ["dependency/*"]
This would enable them via --all-features but it's not elegant way as the user who runs these examples would just do cargo run --example foo without too much thinking.
Option 1 - --all-features to enable contextual required-features
If cargo run --all-features --example foo
is ran -
I would expect cargo to enable the required-features on dependencies contextually on per-target basis.
Option 2 - features under [[target]]
Re-think #1570 and perhaps support feature enable trigger under [[target]]
Option 3 - fix --features with --all-features
See #10333
Notes
This was discussed in zulip
https://rust-lang.zulipchat.com/#narrow/stream/246057-t-cargo/topic/.60--all-features.60.20ignores.20.60--features.60.20and.20suggests.20using.20it/near/269409108