-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Remove disabled optional weak dependencies when resolving #16424
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
base: master
Are you sure you want to change the base?
Conversation
|
r? @weihanglo rustbot has assigned @weihanglo. Use |
This comment has been minimized.
This comment has been minimized.
|
I won't be up for reviewing the core part of this, so my comments are a pre-review. Please clean up commits for how they should be reviewed and merged. r? @Eh2406 |
0845b68 to
b1733c6
Compare
b1733c6 to
7bf935f
Compare
|
I haven't done a review of the approach, I wonder whether this supports the |
7bf935f to
1b71270
Compare
It passed. I port 4 tests from your pull request, and EDIT: it's now done. |
53f926c to
40618b9
Compare
|
This PR was rebased onto a different master commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
Thank you for cleaning up your commits! btw something we've found helpful is to add all tests in one or more commits before the fix, with them passing (showing the existing behavior). The commit that introduces the change then updates the test. The diff of the commits then helps to show how behavior changed. See https://doc.crates.io/contrib/process/working-on-cargo.html#submitting-a-pull-request |
40618b9 to
57362b7
Compare
tests/testsuite/weak_dep_features.rs
Outdated
| // bar is inside lockfile. | ||
| assert_contains!(lockfile, r#"version = 4"#, r#"name = "bar""#); |
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.
I'd recommend following the existing testing patterns, rather than creating new ones. We tend to use snapshot tests of the complete output.
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.
Weak dependency feature related packages usually only appear in Cargo.lock and [Downloading], cargo tree or cargo check won't show they are here or not, thus I read Cargo.lock.
Anyway, I've changed to snapshot.
Co-authored-by: @est31 Signed-off-by: Jackhr-arch <[email protected]>
…eeded Signed-off-by: Jackhr-arch <[email protected]>
57362b7 to
2ea734d
Compare
Signed-off-by: Jackhr-arch <[email protected]>
2ea734d to
cfcff17
Compare

What does this PR try to resolve?
it changes the parts of the resolver that generate Cargo.lock to not include weak dependencies.
Instead of treating weak feature as strong one, now resolver keeps the weak dependency features until the very dependency is checked. Then it combines the weak features with the original ones.
Related to #10801
How to test and review this PR?
I've enabled some tests in
crates/resolver-testsrelating toWeak dependenciesand looks they work fine.Here is an example repo https://github.com/Jackhr-arch/cargo-weak-dep-feat-example