Skip to content

Commit

Permalink
Auto merge of #14700 - kornelski:patchdash, r=weihanglo
Browse files Browse the repository at this point in the history
Help with [patch.crates.io]

This catches a syntactical mistake in TOML that's easy to make by patching `[patch.crates.io]` instead of `[patch.crates-io]`.

```diff
 error: failed to parse manifest at `Cargo.toml`

 Caused by:
   [patch] entry `crates` should be a URL or registry name
+  For crates.io, use [patch.crates-io] (with a dash)

 Caused by:
   invalid url `crates`: relative URL without a base
 ```
  • Loading branch information
bors committed Oct 17, 2024
2 parents 2835ddc + b07c611 commit 6f92aaa
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1892,8 +1892,13 @@ fn patch(
.or_else(|_| toml_url.into_url())
.with_context(|| {
format!(
"[patch] entry `{}` should be a URL or registry name",
toml_url
"[patch] entry `{}` should be a URL or registry name{}",
toml_url,
if toml_url == "crates" {
"\nFor crates.io, use [patch.crates-io] (with a dash)"
} else {
""
}
)
})?,
};
Expand Down

0 comments on commit 6f92aaa

Please sign in to comment.