Auto merge of #14700 - kornelski:patchdash, r=weihanglo

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
 ```
This commit is contained in:
bors 2024-10-17 11:26:30 +00:00
commit 6f92aaa31f

View File

@ -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 {
""
}
)
})?,
};