Skip to content

Commit

Permalink
Auto merge of rust-lang#9912 - ehuss:beta-revert-9686, r=alexcrichton
Browse files Browse the repository at this point in the history
[beta] Revert "When a dependency does not have a version, git or path…

…, fails directly"

This reverts commit 98d5d10, reversing
changes made to 3658906.

Reverting rust-lang#9686

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

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

p.cargo("build")
.with_status(101)
.with_stderr(
.with_stderr_contains(
"\
[ERROR] failed to parse manifest at `[..]`
Caused by:
dependency (bar) specified without providing a local path, Git repository, or version \
to use.
warning: dependency (bar) specified without providing a local path, Git repository, or version \
to use. This will be considered an error in future versions
",
)
.run();
Expand Down
2 changes: 2 additions & 0 deletions tests/testsuite/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ Caused by:
);

#[derive(Debug, Deserialize)]
#[allow(dead_code)]
struct S {
f1: i64,
f2: String,
Expand Down Expand Up @@ -1155,6 +1156,7 @@ fn table_merge_failure() {
);

#[derive(Debug, Deserialize)]
#[allow(dead_code)]
struct Table {
key: StringList,
}
Expand Down

0 comments on commit eb89c13

Please sign in to comment.