-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enable target-required-features with --all-features #10332
Comments
Sorry, I'm having a hard time trying to understand what this issue is asking for. Can you show an example project, and what is difficult to manage in it? Which cargo commands are you trying to run? I'm also not quite following what is meant by |
@ehuss I created this in collaboration (and written before it was merged) with Issue #10333 and is derived as an addition to that #10333 now has fixed to a level that you can now manually enable additional Core of the problem is Also we discussed this in zulip which led to these two issues - This is for any However #10333 didn't go more in to describing that we probably don't want to be listing all the downstream package dependency features in our root package manifest Since anotherpkg/x would be additive when we already have anotherpkg as dependency we should be able to toggle more anotherpkg features: e.g. this will not work with
My additional take on to #10333 was that was since every Can't we just say e.g. when cargo builds Since otherwise you have to either proxy this via root package features or manually toggle every feature on via |
I'm still having a hard time trying to follow, but I believe If you're asking that you want building an example to automatically enable a feature, there are other existing issues like #1982 (and accompanying RFCs like rust-lang/rfcs#3020 or rust-lang/rfcs#2887). That would make it so that in your example, Does that cover your use case? |
So looks like @pksunkara was going to work on changing something by adding Considering the history of how I was merely proposing to work solely with Whilst considering the above history and the RFCs - I understand that using solely I was simply proposing for cargo to enable features dynamically from e.g. if I want to build all Or - relevant to rust-lang/rfcs/#3020 - use another field to describe what features I need from elsewhere when the The error also seems redundant that complains some Bottom line: So is cargo going to preserve Maybe I should roll a PR - maybe that is easiest.... In the meantime I will close this as rust-lang/rfcs/#3020 was going already on this - I will add my input to it. |
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
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
The text was updated successfully, but these errors were encountered: