Skip to content

Commit 5dde9cc

Browse files
committed
Show patch location in error message.
1 parent 6fd11a7 commit 5dde9cc

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

src/cargo/core/registry.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -812,16 +812,18 @@ fn summary_for_patch(
812812
};
813813
if found.is_empty() {
814814
anyhow::bail!(
815-
"The patch location does not appear to contain any packages \
815+
"The patch location `{}` does not appear to contain any packages \
816816
matching the name `{}`.",
817+
orig_patch.source_id(),
817818
orig_patch.package_name()
818819
);
819820
} else {
820821
anyhow::bail!(
821-
"The patch location contains a `{}` package with {}, but the patch \
822+
"The patch location `{}` contains a `{}` package with {}, but the patch \
822823
definition requires `{}`.\n\
823824
Check that the version in the patch location is what you expect, \
824825
and update the patch definition to match.",
826+
orig_patch.source_id(),
825827
orig_patch.package_name(),
826828
found,
827829
orig_patch.version_req()

tests/testsuite/patch.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1614,7 +1614,7 @@ Caused by:
16141614
patch for `bar` in `https://github.com/rust-lang/crates.io-index` did not resolve to any crates
16151615
16161616
Caused by:
1617-
The patch location does not appear to contain any packages matching the name `bar`.
1617+
The patch location `[..]/foo/bar` does not appear to contain any packages matching the name `bar`.
16181618
",
16191619
)
16201620
.run();
@@ -1653,7 +1653,7 @@ Caused by:
16531653
patch for `bar` in `https://github.com/rust-lang/crates.io-index` did not resolve to any crates
16541654
16551655
Caused by:
1656-
The patch location contains a `bar` package with version `0.1.0`, \
1656+
The patch location `[..]/foo/bar` contains a `bar` package with version `0.1.0`, \
16571657
but the patch definition requires `^0.1.1`.
16581658
Check that the version in the patch location is what you expect, \
16591659
and update the patch definition to match.
@@ -1763,7 +1763,7 @@ Caused by:
17631763
patch for `bar` in `https://github.com/rust-lang/crates.io-index` did not resolve to any crates
17641764
17651765
Caused by:
1766-
The patch location contains a `bar` package with version `0.1.0`, but the patch definition requires `^0.1.1`.
1766+
The patch location `[..]/foo/bar` contains a `bar` package with version `0.1.0`, but the patch definition requires `^0.1.1`.
17671767
Check that the version in the patch location is what you expect, and update the patch definition to match.
17681768
",
17691769
)

0 commit comments

Comments
 (0)