Skip to content

Commit

Permalink
Make ignored key in config be an error
Browse files Browse the repository at this point in the history
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
  • Loading branch information
Rustin170506 committed Jul 15, 2021
1 parent 85ba14c commit 6f214ac
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
9 changes: 4 additions & 5 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1734,12 +1734,11 @@ impl<P: ResolveToPath> DetailedTomlDependency<P> {

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)
}
}
}
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 @@ -1183,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();
}
Expand Down

0 comments on commit 6f214ac

Please sign in to comment.