Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change some warnings to errors #9689

Merged
merged 2 commits into from
Jul 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 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 Expand Up @@ -1791,13 +1790,11 @@ impl<P: ResolveToPath> DetailedTomlDependency<P> {
),
(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]
Expand Down
19 changes: 12 additions & 7 deletions tests/testsuite/bad_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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();
}
Expand Down