Make the dependency specification ambiguous be an error

Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
hi-rustin 2021-07-15 14:29:11 +08:00
parent 66a6737a0c
commit 85ba14c68d
2 changed files with 7 additions and 8 deletions

View File

@ -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]

View File

@ -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();