-
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
feat: implement workspace feature unification #15157
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @weihanglo (or someone else) some time within the next two weeks. Please see the contribution instructions for more information. Namely, in order to ensure the minimum review times lag, PR authors and assigned reviewers should ensure that the review label (
|
A couple of high level comments
|
To add, for
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For adding new unstable configurations, see
- https://doc.crates.io/contrib/process/unstable.html
- https://doc.rust-lang.org/nightly/nightly-rustc/cargo/core/features/index.html
We usually also add an unstable doc whenever we add a new unstable feature. The doc draft has been written in the RFC. Feel free to copy and adjust. If you feel writing doc is too much a burden, let us know we can do it in a follow-up PR.
Thank you @epage and @weihanglo for the quick feedback! This is my first PR to cargo, so apologies if I didn't get some things right regarding the process, etc. I will try to address the comments and push an update today. |
@rustbot author |
d14e1df
to
f5ebb8a
Compare
2ee949b
to
fdf0feb
Compare
fdf0feb
to
a471adb
Compare
@rustbot review |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome! Thank you for the contribution.
What does this PR try to resolve?
Adds workspace feature unification for #14774
How should we test and review this PR?
In a workspace that has dependencies with different activated features depending on the packages being built, add the
resolver.feature-unification = "workspace"
option to.cargo/config.toml
. Build the entire workspace with--workspace
and then build individual packages, ensuring no dependencies are being recompiled.Additional information
Originally, the RFC and tracking issue mention some more complex changes required in cargo's dependency/feature resolution phases in order to support workspace feature unification. However, it seems like it also works by just modifying the list of
PackageIdSpec
s passed to the workspace resolver to include all workspace members, and then using the original list of specs when generating the build units. I'm wondering if I missed something because this change feels a bit too simple...I tested it on a fairly large workspace containing about 100 packages and didn't see any recompilations when building with different sets of packages. I also added an integration test that verifies the correct features are enabled. If there are any other test cases I should include, please let me know and I'll try to add it.