From af0cd9fc5aa6c831779c54a63007eac19d0d93e6 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Thu, 20 Apr 2023 09:32:24 +0800 Subject: [PATCH] Improve error message for empty dep Signed-off-by: hi-rustin --- src/cargo/util/toml/mod.rs | 4 ++-- tests/testsuite/bad_config.rs | 4 ++-- tests/testsuite/inheritable_workspace_fields.rs | 8 ++++++-- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 9e7c6f63e20..c5ee85e0312 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -2908,8 +2908,8 @@ impl DetailedTomlDependency

{ if self.version.is_none() && self.path.is_none() && self.git.is_none() { let msg = format!( "dependency ({}) specified without \ - providing a local path, Git repository, or \ - version to use. This will be considered an \ + providing a local path, Git repository, version, or \ + workspace dependency to use. This will be considered an \ error in future versions", name_in_toml ); diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index ca51b101e39..3a13ce629a9 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -780,8 +780,8 @@ fn empty_dependencies() { p.cargo("check") .with_stderr_contains( "\ -warning: dependency (bar) specified without providing a local path, Git repository, or version \ -to use. This will be considered an error in future versions +warning: 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 ", ) .run(); diff --git a/tests/testsuite/inheritable_workspace_fields.rs b/tests/testsuite/inheritable_workspace_fields.rs index 92c96b985a5..d63437260fb 100644 --- a/tests/testsuite/inheritable_workspace_fields.rs +++ b/tests/testsuite/inheritable_workspace_fields.rs @@ -1269,7 +1269,9 @@ fn error_workspace_dependency_looked_for_workspace_itself() { .with_stderr( "\ [WARNING] [CWD]/Cargo.toml: unused manifest key: workspace.dependencies.dep.workspace -[WARNING] [CWD]/Cargo.toml: dependency (dep) specified without providing a local path, Git repository, or version to use. This will be considered an error in future versions +[WARNING] [CWD]/Cargo.toml: dependency (dep) 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] no matching package named `dep` found location searched: registry `crates-io` @@ -1589,7 +1591,9 @@ fn cannot_inherit_in_patch() { .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, or version to use. This will be considered an error in future versions +[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`