Skip to content

Commit 680eadc

Browse files
committed
Auto merge of #9689 - hi-rustin:rustin-patch-error, r=alexcrichton
Change some warnings to errors These warnings are over three years old, so maybe we can adjust it to an error.
2 parents 66a6737 + 6f214ac commit 680eadc

File tree

2 files changed

+18
-16
lines changed

2 files changed

+18
-16
lines changed

src/cargo/util/toml/mod.rs

+6-9
Original file line numberDiff line numberDiff line change
@@ -1734,12 +1734,11 @@ impl<P: ResolveToPath> DetailedTomlDependency<P> {
17341734

17351735
for &(key, key_name) in &git_only_keys {
17361736
if key.is_some() {
1737-
let msg = format!(
1738-
"key `{}` is ignored for dependency ({}). \
1739-
This will be considered an error in future versions",
1740-
key_name, name_in_toml
1737+
bail!(
1738+
"key `{}` is ignored for dependency ({}).",
1739+
key_name,
1740+
name_in_toml
17411741
);
1742-
cx.warnings.push(msg)
17431742
}
17441743
}
17451744
}
@@ -1791,13 +1790,11 @@ impl<P: ResolveToPath> DetailedTomlDependency<P> {
17911790
),
17921791
(Some(git), maybe_path, _, _) => {
17931792
if maybe_path.is_some() {
1794-
let msg = format!(
1793+
bail!(
17951794
"dependency ({}) specification is ambiguous. \
1796-
Only one of `git` or `path` is allowed. \
1797-
This will be considered an error in future versions",
1795+
Only one of `git` or `path` is allowed.",
17981796
name_in_toml
17991797
);
1800-
cx.warnings.push(msg)
18011798
}
18021799

18031800
let n_details = [&self.branch, &self.tag, &self.rev]

tests/testsuite/bad_config.rs

+12-7
Original file line numberDiff line numberDiff line change
@@ -1112,11 +1112,12 @@ fn both_git_and_path_specified() {
11121112

11131113
foo.cargo("build -v")
11141114
.with_status(101)
1115-
.with_stderr_contains(
1115+
.with_stderr(
11161116
"\
1117-
[WARNING] dependency (bar) specification is ambiguous. \
1118-
Only one of `git` or `path` is allowed. \
1119-
This will be considered an error in future versions
1117+
error: failed to parse manifest at `[..]`
1118+
1119+
Caused by:
1120+
dependency (bar) specification is ambiguous. Only one of `git` or `path` is allowed.
11201121
",
11211122
)
11221123
.run();
@@ -1182,9 +1183,13 @@ fn ignored_git_revision() {
11821183

11831184
foo.cargo("build -v")
11841185
.with_status(101)
1185-
.with_stderr_contains(
1186-
"[WARNING] key `branch` is ignored for dependency (bar). \
1187-
This will be considered an error in future versions",
1186+
.with_stderr(
1187+
"\
1188+
error: failed to parse manifest at `[..]`
1189+
1190+
Caused by:
1191+
key `branch` is ignored for dependency (bar).
1192+
",
11881193
)
11891194
.run();
11901195
}

0 commit comments

Comments
 (0)