]> git.proxmox.com Git - cargo.git/commitdiff
When a dependency does not have a version, git or path, fails directly
authorhi-rustin <rustin.liu@gmail.com>
Wed, 14 Jul 2021 06:09:45 +0000 (14:09 +0800)
committerhi-rustin <rustin.liu@gmail.com>
Wed, 14 Jul 2021 06:09:45 +0000 (14:09 +0800)
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
src/cargo/util/toml/mod.rs
tests/testsuite/bad_config.rs

index dc0e61b7a7135bf399ef9f36df8da2a944ea67e3..1c95e50fa89b4ab8b28dd6050bda95282bbcc85a 100644 (file)
@@ -1707,14 +1707,11 @@ impl<P: ResolveToPath> DetailedTomlDependency<P> {
         kind: Option<DepKind>,
     ) -> CargoResult<Dependency> {
         if self.version.is_none() && self.path.is_none() && self.git.is_none() {
-            let msg = format!(
+            bail!(
                 "dependency ({}) specified without \
-                 providing a local path, Git repository, or \
-                 version to use. This will be considered an \
-                 error in future versions",
+                 providing a local path, Git repository, or version to use.",
                 name_in_toml
             );
-            cx.warnings.push(msg);
         }
 
         if let Some(version) = &self.version {
index be242bff22b78211c2b0de32f0a63422e197dee5..c9a2f6e11c6253d110c13c0d2323c101258da198 100644 (file)
@@ -796,10 +796,14 @@ fn empty_dependencies() {
     Package::new("bar", "0.0.1").publish();
 
     p.cargo("build")
-        .with_stderr_contains(
+        .with_status(101)
+        .with_stderr(
             "\
-warning: dependency (bar) specified without providing a local path, Git repository, or version \
-to use. This will be considered an error in future versions
+[ERROR] failed to parse manifest at `[..]`
+
+Caused by:
+  dependency (bar) specified without providing a local path, Git repository, or version \
+to use.
 ",
         )
         .run();