* targeted error message for virtual manifests
* assert correct error message
This commit is contained in:
Timothy Bess 2018-02-28 16:43:08 -05:00
parent 7334fe42b8
commit 05b896ac90
2 changed files with 7 additions and 4 deletions

View 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)
}
}

View 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));
}