diff --git a/src/cargo/util/toml/mod.rs b/src/cargo/util/toml/mod.rs index 1c95e50fa89..dc6e3855901 100644 --- a/src/cargo/util/toml/mod.rs +++ b/src/cargo/util/toml/mod.rs @@ -1734,12 +1734,11 @@ impl DetailedTomlDependency

{ for &(key, key_name) in &git_only_keys { if key.is_some() { - let msg = format!( - "key `{}` is ignored for dependency ({}). \ - This will be considered an error in future versions", - key_name, name_in_toml + bail!( + "key `{}` is ignored for dependency ({}).", + key_name, + name_in_toml ); - cx.warnings.push(msg) } } } @@ -1791,13 +1790,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 c9a2f6e11c6..05f755a2ecb 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(); @@ -1182,9 +1183,13 @@ fn ignored_git_revision() { foo.cargo("build -v") .with_status(101) - .with_stderr_contains( - "[WARNING] key `branch` is ignored for dependency (bar). \ - This will be considered an error in future versions", + .with_stderr( + "\ +error: failed to parse manifest at `[..]` + +Caused by: + key `branch` is ignored for dependency (bar). +", ) .run(); }