From 85ba14c68ddacffc09f1163a7fc1a359075c55a8 Mon Sep 17 00:00:00 2001 From: hi-rustin Date: Thu, 15 Jul 2021 14:29:11 +0800 Subject: [PATCH] Make the dependency specification ambiguous be an error Signed-off-by: hi-rustin --- src/cargo/util/toml/mod.rs | 6 ++---- tests/testsuite/bad_config.rs | 9 +++++---- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 1c95e50fa..3fd5e6a99 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -1791,13 +1791,11 @@ impl DetailedTomlDependency

{ ), (Some(git), maybe_path, _, _) => { if maybe_path.is_some() { - let msg = format!( + bail!( "dependency ({}) specification is ambiguous. \ - Only one of `git` or `path` is allowed. \ - This will be considered an error in future versions", + Only one of `git` or `path` is allowed.", name_in_toml ); - cx.warnings.push(msg) } let n_details = [&self.branch, &self.tag, &self.rev] diff --git a/tests/testsuite/bad_config.rs b/tests/testsuite/bad_config.rs index c9a2f6e11..732f6f1b4 100644 --- a/tests/testsuite/bad_config.rs +++ b/tests/testsuite/bad_config.rs @@ -1112,11 +1112,12 @@ fn both_git_and_path_specified() { foo.cargo("build -v") .with_status(101) - .with_stderr_contains( + .with_stderr( "\ -[WARNING] dependency (bar) specification is ambiguous. \ -Only one of `git` or `path` is allowed. \ -This will be considered an error in future versions +error: failed to parse manifest at `[..]` + +Caused by: + dependency (bar) specification is ambiguous. Only one of `git` or `path` is allowed. ", ) .run(); -- 2.39.5