Skip to content

Commit d65a714

Browse files
committed
Reject ambiguous git dependency declaration.
1 parent de42302 commit d65a714

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/cargo/util/toml/mod.rs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1692,13 +1692,11 @@ impl DetailedTomlDependency {
16921692
.count();
16931693

16941694
if n_details > 1 {
1695-
let msg = format!(
1695+
bail!(
16961696
"dependency ({}) specification is ambiguous. \
1697-
Only one of `branch`, `tag` or `rev` is allowed. \
1698-
This will be considered an error in future versions",
1697+
Only one of `branch`, `tag` or `rev` is allowed.",
16991698
name_in_toml
17001699
);
1701-
cx.warnings.push(msg)
17021700
}
17031701

17041702
let reference = self

tests/testsuite/bad_config.rs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -851,11 +851,12 @@ fn ambiguous_git_reference() {
851851

852852
p.cargo("build -v")
853853
.with_status(101)
854-
.with_stderr_contains(
854+
.with_stderr(
855855
"\
856-
[WARNING] dependency (bar) specification is ambiguous. \
857-
Only one of `branch`, `tag` or `rev` is allowed. \
858-
This will be considered an error in future versions
856+
[ERROR] failed to parse manifest at `[..]`
857+
858+
Caused by:
859+
dependency (bar) specification is ambiguous. Only one of `branch`, `tag` or `rev` is allowed.
859860
",
860861
)
861862
.run();

0 commit comments

Comments
 (0)