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

Revert "When a dependency does not have a version, git or path, fails directly" #9911

Merged
merged 1 commit into from
Sep 14, 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
7 changes: 5 additions & 2 deletions src/cargo/util/toml/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1762,11 +1762,14 @@ impl<P: ResolveToPath> DetailedTomlDependency<P> {
kind: Option<DepKind>,
) -> CargoResult<Dependency> {
if self.version.is_none() && self.path.is_none() && self.git.is_none() {
bail!(
let msg = format!(
"dependency ({}) specified without \
providing a local path, Git repository, or version to use.",
providing a local path, Git repository, or \
version to use. This will be considered an \
error in future versions",
name_in_toml
);
cx.warnings.push(msg);
}

if let Some(version) = &self.version {
Expand Down
10 changes: 3 additions & 7 deletions tests/testsuite/bad_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -763,14 +763,10 @@ fn empty_dependencies() {
Package::new("bar", "0.0.1").publish();

p.cargo("build")
.with_status(101)
.with_stderr(
.with_stderr_contains(
"\
[ERROR] failed to parse manifest at `[..]`

Caused by:
dependency (bar) specified without providing a local path, Git repository, or version \
to use.
warning: dependency (bar) specified without providing a local path, Git repository, or version \
to use. This will be considered an error in future versions
",
)
.run();
Expand Down