From 8f3be5dbeb6a2faa17c4f733a514ba0deededb8d Mon Sep 17 00:00:00 2001 From: Eric Huss Date: Tue, 14 Sep 2021 13:05:44 -0700 Subject: [PATCH 1/2] [beta] Revert "When a dependency does not have a version, git or path, fails directly" This reverts commit 98d5d10268684d337d70caa2b0b95cc4c13b34f9, reversing changes made to 3658906b0700ec70c727d95f5cdecc7c61a95a82. Reverting #9686 --- src/cargo/util/toml/mod.rs | 7 +++++-- tests/testsuite/bad_config.rs | 10 +++------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 059c4480377..019dc346dd5 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -1762,11 +1762,14 @@ impl DetailedTomlDependency

{ kind: Option, ) -> CargoResult { 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 { diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index e5e1775ad85..330a0c5829a 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -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(); From c7b13235ad28a301bb8c55d7060fc5898fb76e92 Mon Sep 17 00:00:00 2001 From: bors Date: Mon, 13 Sep 2021 17:31:11 +0000 Subject: [PATCH 2/2] Auto merge of #9906 - camelid:fix-warnings, r=alexcrichton Fix warnings from better precision of `dead_code` lint The lint now ignores derived `Clone` and `Debug` implementations, as of PR rust-lang/rust#85200, which landed a couple of days ago. I sprinkled `#[allow(dead_code)]` in a few places; the fields are not expected to be read since they are just part of a very specific test. --- tests/testsuite/config.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/testsuite/config.rs b/tests/testsuite/config.rs index 1468cdef39a..aa585c993a1 100644 --- a/tests/testsuite/config.rs +++ b/tests/testsuite/config.rs @@ -656,6 +656,7 @@ Caused by: ); #[derive(Debug, Deserialize)] + #[allow(dead_code)] struct S { f1: i64, f2: String, @@ -1155,6 +1156,7 @@ fn table_merge_failure() { ); #[derive(Debug, Deserialize)] + #[allow(dead_code)] struct Table { key: StringList, }