Issue #5087
authorTimothy Bess <timbessmail@gmail.com>
Wed, 28 Feb 2018 21:43:08 +0000 (16:43 -0500)
committerTimothy Bess <timbessmail@gmail.com>
Wed, 28 Feb 2018 21:43:08 +0000 (16:43 -0500)
* targeted error message for virtual manifests
* assert correct error message

src/cargo/ops/cargo_compile.rs
tests/testsuite/build.rs

index 4ff4e240d86399deab6a68804d7cda01284b1e34..dcb3acfbca895157a96d9bd30850e3ba0d70ce6e 100644 (file)
@@ -156,11 +156,13 @@ impl<'a> Packages<'a> {
             }
         };
         if specs.is_empty() {
-            bail!("Workspace contains no members to be compiled. \
-                   Be sure all workspace members haven't been excluded")
-        } else {
-            Ok(specs)
+            match ws.is_virtual() {
+                true => bail!("manifest path `{}` contains no package: The manifest is virtual, \
+                                       and the workspace has no members.", ws.root().display()),
+                false => bail!("no packages to compile"),
+            }
         }
+        Ok(specs)
     }
 }
 
index 9dfafc133279443274e5d4aa0332646ec56db0e4..51b449af5644bd92310cfcfa7afa73fe3dae655b 100644 (file)
@@ -152,6 +152,7 @@ fn cargo_compile_with_workspace_excluded() {
     assert_that(
         p.cargo("build").arg("--all").arg("--exclude").arg("foo"),
         execs().with_stderr_does_not_contain("[..]virtual[..]")
+            .with_stderr_contains("[..]no packages to compile")
             .with_status(101));
 }