-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of #12454 - alcolmenar:alcolmenar/fix-invalid-rm, r=epage
Fix cargo remove incorrectly removing used patches ### What does this PR try to resolve? Fixes an issue where patches are being removed when member dependencies don't explicitly contain the patched crate. Fixes #12419 ### How should we test and review this PR? - Created a test for the failing use case - Verify passing test <!-- ### Additional information Other information you want to mention in this PR, such as prior arts, future extensions, an unresolved problem, or a TODO list. -->
- Loading branch information
Showing
36 changed files
with
155 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing clippy from dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing semver from build-dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing regex from dev-dependencies | ||
Updating `dummy-registry` index |
8 changes: 8 additions & 0 deletions
8
tests/testsuite/cargo_remove/gc_keep_used_patch/in/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Cargo.toml | ||
|
||
[workspace] | ||
members = ["serde", "serde_derive"] | ||
|
||
[patch.crates-io] | ||
serde = { path = "serde" } | ||
|
9 changes: 9 additions & 0 deletions
9
tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# serde/Cargo.toml | ||
|
||
[package] | ||
name = "serde" | ||
version = "1.0.0" | ||
|
||
[dependencies] | ||
serde_derive = { path = "../serde_derive" } | ||
|
Empty file.
8 changes: 8 additions & 0 deletions
8
tests/testsuite/cargo_remove/gc_keep_used_patch/in/serde_derive/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# serde_derive/Cargo.toml | ||
|
||
[package] | ||
name = "serde_derive" | ||
version = "1.0.0" | ||
|
||
[dev-dependencies] | ||
serde_json = "1.0.0" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
use cargo_test_support::compare::assert_ui; | ||
use cargo_test_support::curr_dir; | ||
use cargo_test_support::CargoCommand; | ||
use cargo_test_support::Project; | ||
|
||
#[cargo_test] | ||
fn case() { | ||
cargo_test_support::registry::init(); | ||
cargo_test_support::registry::Package::new("serde", "1.0.0").publish(); | ||
cargo_test_support::registry::Package::new("serde_json", "1.0.0") | ||
.dep("serde", "1.0.0") | ||
.publish(); | ||
|
||
let project = Project::from_template(curr_dir!().join("in")); | ||
let project_root = project.root(); | ||
|
||
snapbox::cmd::Command::cargo_ui() | ||
.current_dir(&project_root) | ||
.arg("remove") | ||
.args(["--package", "serde", "serde_derive"]) | ||
.assert() | ||
.code(0) | ||
.stdout_matches_path(curr_dir!().join("stdout.log")) | ||
.stderr_matches_path(curr_dir!().join("stderr.log")); | ||
|
||
assert_ui().subset_matches(curr_dir!().join("out"), &project_root); | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/testsuite/cargo_remove/gc_keep_used_patch/out/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Cargo.toml | ||
|
||
[workspace] | ||
members = ["serde", "serde_derive"] | ||
|
||
[patch.crates-io] | ||
serde = { path = "serde" } | ||
|
6 changes: 6 additions & 0 deletions
6
tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
# serde/Cargo.toml | ||
|
||
[package] | ||
name = "serde" | ||
version = "1.0.0" | ||
|
Empty file.
8 changes: 8 additions & 0 deletions
8
tests/testsuite/cargo_remove/gc_keep_used_patch/out/serde_derive/Cargo.toml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# serde_derive/Cargo.toml | ||
|
||
[package] | ||
name = "serde_derive" | ||
version = "1.0.0" | ||
|
||
[dev-dependencies] | ||
serde_json = "1.0.0" |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Removing serde_derive from dependencies |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1 @@ | ||
Removing bar from dependencies | ||
Updating git repository `[ROOTURL]/bar2` | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing toml from dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing toml from dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
Removing docopt from dependencies | ||
Removing semver from dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,2 @@ | ||
Removing regex from dev-dependencies | ||
Removing serde from dev-dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing serde from dev-dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing semver from dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing docopt from dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing docopt from dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing dbus from dependencies for target `x86_64-unknown-linux-gnu` | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing semver from build-dependencies for target `x86_64-unknown-linux-gnu` | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing ncurses from dev-dependencies for target `x86_64-unknown-linux-gnu` | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing rustc-serialize from dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing semver from build-dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing semver from build-dependencies | ||
Updating `dummy-registry` index |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
Removing semver from build-dependencies | ||
Updating `dummy-registry` index |