-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Open
Labels
A-diagnosticsArea: Error and warning messages generated by Cargo itself.Area: Error and warning messages generated by Cargo itself.A-patchArea: [patch] table overrideArea: [patch] table overrideA-workspace-inheritanceArea: workspace inheritance RFC 2906Area: workspace inheritance RFC 2906C-bugCategory: bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.
Description
Problem
Unclear error message when workspace dep cannot be inherited in patch. See also #12001 (comment)
Steps
- Try
cannot_inherit_in_patch
unit test.
#[cargo_test]
fn cannot_inherit_in_patch() {
Package::new("bar", "0.1.0").publish();
let p = project()
.file(
"Cargo.toml",
r#"
[workspace]
members = []
[workspace.dependencies]
bar = { path = "bar" }
[package]
name = "foo"
version = "0.2.0"
[patch.crates-io]
bar.workspace = true
[dependencies]
bar = "0.1.0"
"#,
)
.file("src/main.rs", "fn main() {}")
.build();
p.cargo("check")
.with_status(101)
.with_stderr(
"\
[WARNING] [CWD]/Cargo.toml: unused manifest key: patch.crates-io.bar.workspace
[WARNING] [CWD]/Cargo.toml: dependency (bar) specified without providing a local path, Git repository, version, \
or workspace dependency to use. \
This will be considered an error in future versions
[UPDATING] `dummy-registry` index
[ERROR] failed to resolve patches for `https://github.com/rust-lang/crates.io-index`
Caused by:
patch for `bar` in `https://github.com/rust-lang/crates.io-index` points to the same source, but patches must point to different sources
",
)
.run();
}
- See the warnings and errors.
Possible Solution(s)
Give a clear error message to say Cargo can not inherit a workspace dep in patch.
Notes
No response
Version
cargo version --verbose
cargo 1.69.0 (6e9a83356 2023-04-12)
release: 1.69.0
commit-hash: 6e9a83356b70586d4b77613a6b33f9ea067b9cdf
commit-date: 2023-04-12
host: aarch64-apple-darwin
libgit2: 1.5.0 (sys:0.16.0 vendored)
libcurl: 7.86.0 (sys:0.4.59+curl-7.86.0 system ssl:(SecureTransport) LibreSSL/3.3.6)
os: Mac OS 13.2.1 [64-bit]
Metadata
Metadata
Assignees
Labels
A-diagnosticsArea: Error and warning messages generated by Cargo itself.Area: Error and warning messages generated by Cargo itself.A-patchArea: [patch] table overrideArea: [patch] table overrideA-workspace-inheritanceArea: workspace inheritance RFC 2906Area: workspace inheritance RFC 2906C-bugCategory: bugCategory: bugS-needs-designStatus: Needs someone to work further on the design for the feature or fix. NOT YET accepted.Status: Needs someone to work further on the design for the feature or fix. NOT YET accepted.