fix confusing error for virtual manifest with no member
authorRalf Jung <post@ralfj.de>
Thu, 14 Sep 2017 11:52:06 +0000 (13:52 +0200)
committerRalf Jung <post@ralfj.de>
Thu, 14 Sep 2017 11:52:06 +0000 (13:52 +0200)
src/cargo/core/workspace.rs
tests/workspaces.rs

index 148e1e9ff44824fcb938bec6ce1c5962d68c897e..1bbcec5905d757894272b4c52dafbd08c1d31bda 100644 (file)
@@ -169,9 +169,8 @@ impl<'cfg> Workspace<'cfg> {
     /// indicating that something else should be passed.
     pub fn current(&self) -> CargoResult<&Package> {
         self.current_opt().ok_or_else(||
-            format!("manifest path `{}` is a virtual manifest, but this \
-                     command requires running against an actual package in \
-                     this workspace", self.current_manifest.display()).into()
+            format!("manifest path `{}` contains no package: The manifest is virtual, \
+                     and the workspace has no members.", self.current_manifest.display()).into()
         )
     }
 
index d7eabcf7a524e07ec1b6594dc7e6d54e15653d1c..68e9468f008b2075efb6d2d29fb0a865e47a197d 100644 (file)
@@ -696,20 +696,13 @@ fn virtual_build_no_members() {
     let p = project("foo")
         .file("Cargo.toml", r#"
             [workspace]
-        "#)
-        .file("bar/Cargo.toml", r#"
-            [project]
-            name = "bar"
-            version = "0.1.0"
-            authors = []
-        "#)
-        .file("bar/src/main.rs", "fn main() {}");
+        "#);
     p.build();
     assert_that(p.cargo("build"),
                 execs().with_status(101)
                        .with_stderr("\
-error: manifest path `[..]` is a virtual manifest, but this command \
-requires running against an actual package in this workspace
+error: manifest path `[..]` contains no package: The manifest is virtual, \
+and the workspace has no members.
 "));
 }