Skip to content

Commit

Permalink
Auto merge of rust-lang#9686 - hi-rustin:rustin-patch-error, r=alexcr…
Browse files Browse the repository at this point in the history
…ichton

When a dependency does not have a version, git or path, fails directly

Make this warning be an error.

ref: rust-lang#9682 (comment)
  • Loading branch information
bors committed Jul 14, 2021
2 parents 3658906 + 5c66070 commit 98d5d10
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
7 changes: 2 additions & 5 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1707,14 +1707,11 @@ impl<P: ResolveToPath> DetailedTomlDependency<P> {
kind: Option<DepKind>,
) -> CargoResult<Dependency> {
if self.version.is_none() && self.path.is_none() && self.git.is_none() {
let msg = format!(
bail!(
"dependency ({}) specified without \
providing a local path, Git repository, or \
version to use. This will be considered an \
error in future versions",
providing a local path, Git repository, or version to use.",
name_in_toml
);
cx.warnings.push(msg);
}

if let Some(version) = &self.version {
Expand Down
10 changes: 7 additions & 3 deletions tests/testsuite/bad_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -796,10 +796,14 @@ fn empty_dependencies() {
Package::new("bar", "0.0.1").publish();

p.cargo("build")
.with_stderr_contains(
.with_status(101)
.with_stderr(
"\
warning: dependency (bar) specified without providing a local path, Git repository, or version \
to use. This will be considered an error in future versions
[ERROR] failed to parse manifest at `[..]`
Caused by:
dependency (bar) specified without providing a local path, Git repository, or version \
to use.
",
)
.run();
Expand Down

0 comments on commit 98d5d10

Please sign in to comment.