Skip to content

Commit

Permalink
Make the dependency specification ambiguous 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 66a6737 commit 85ba14c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
6 changes: 2 additions & 4 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1791,13 +1791,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
9 changes: 5 additions & 4 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

0 comments on commit 85ba14c

Please sign in to comment.