Skip to content

Commit

Permalink
Auto merge of #12001 - hi-rustin:rustin-patch-dep-empty, r=weihanglo
Browse files Browse the repository at this point in the history
Improve error message for empty dep
  • Loading branch information
bors committed Apr 24, 2023
2 parents 39a972d + af0cd9f commit b5177c6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2997,8 +2997,8 @@ impl<P: ResolveToPath + Clone> DetailedTomlDependency<P> {
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
);
Expand Down
4 changes: 2 additions & 2 deletions tests/testsuite/bad_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions tests/testsuite/inheritable_workspace_fields.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`
Expand Down Expand Up @@ -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`
Expand Down

0 comments on commit b5177c6

Please sign in to comment.