-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Clean profile, patch, and replace in cargo remove #11194
Conversation
r? @epage (rust-highfive has picked a reviewer for you, use r? to override) |
e82c234
to
081d656
Compare
7ee5928
to
b0b86a3
Compare
Clean up workspace dependencies after cargo remove ### What does this PR try to resolve? After successful removal of an inherited dependency from a workspace member, clean up the root workspace manifest. This PR is part of the continued working on cargo remove (#11099, see deferred work). ### How should we test and review this PR? Make sure the tests cover all possible use cases. After posting this PR, I will post a short self-review regarding some design concerns. ### Additional information #11194 is currently blocked on this feature.
b0b86a3
to
dd1cd3a
Compare
No longer blocked on #11242, so I've (hopefully) finished up the work on this feature. Here's what's new:
|
Okay, I fixed a these issues last night, but I found another bug pertaining to the replace section: since |
After more investigation, it turns out profile and patch also have similar issues. The profile override also needs to support the package ID spec as well. |
dd1cd3a
to
b292a75
Compare
Issues have been fixed. A few notes to help with review:
|
☔ The latest upstream changes (presumably #11375) made this pull request unmergeable. Please resolve the merge conflicts. |
c05bd27
to
5d3ed21
Compare
5d3ed21
to
c3ba61c
Compare
Changes made. I also noticed that workspace dependencies might not be properly handled by the likes of |
c3ba61c
to
2056f8d
Compare
After a successful removal of a dependency, clean up the profile, patch, and replace sections to remove all references to the dependency.
2056f8d
to
299252c
Compare
@bors r+ |
☀️ Test successful - checks-actions |
7 commits in eb5d35917b2395194593c9ca70c3778f60c1573b..ba607b23db8398723d659249d9abf5536bc322e5 2022-11-17 22:08:43 +0000 to 2022-11-22 20:52:39 +0000 - Fix failure to parse rustc's JSON output if it is too nested (rust-lang/cargo#11368) - Add suggestions when `cargo add` multiple packages (rust-lang/cargo#11186) - Update mod.rs (rust-lang/cargo#11395) - Fix typo `try use` -> `try to use` (rust-lang/cargo#11394) - Add warning when `cargo tree -i <spec>` can not find packages (rust-lang/cargo#11377) - Clean profile, patch, and replace in cargo remove (rust-lang/cargo#11194) - chore: Upgrade miow (rust-lang/cargo#11391)
Update cargo 7 commits in eb5d35917b2395194593c9ca70c3778f60c1573b..ba607b23db8398723d659249d9abf5536bc322e5 2022-11-17 22:08:43 +0000 to 2022-11-22 20:52:39 +0000 - Fix failure to parse rustc's JSON output if it is too nested (rust-lang/cargo#11368) - Add suggestions when `cargo add` multiple packages (rust-lang/cargo#11186) - Update mod.rs (rust-lang/cargo#11395) - Fix typo `try use` -> `try to use` (rust-lang/cargo#11394) - Add warning when `cargo tree -i <spec>` can not find packages (rust-lang/cargo#11377) - Clean profile, patch, and replace in cargo remove (rust-lang/cargo#11194) - chore: Upgrade miow (rust-lang/cargo#11391)
What does this PR try to resolve?
This PR is part of the continued work on cargo remove (#11099, see deferred work).
After a successful removal of a dependency, clean up the profile, patch, and replace sections to remove all references to it.
Note the GC process was expanded to clean up not just references to the dependencies just removed, but also references of all dependencies. This was because there's not an easy way to determine which dependencies correspond to the given TOML keys, without either 1) figuring that out before the removal (therefore having to predict the behavior), or 2) returning that information from the remove function (somewhat unorthodox for an op).
How should we review and test this PR?
Verify that the implementation makes sense and that the tests are sufficient.