From 05b896ac90261774924989bcd86585f993696ee1 Mon Sep 17 00:00:00 2001 From: Timothy Bess Date: Wed, 28 Feb 2018 16:43:08 -0500 Subject: [PATCH] Issue #5087 * targeted error message for virtual manifests * assert correct error message --- src/cargo/ops/cargo_compile.rs | 10 ++++++---- tests/testsuite/build.rs | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/cargo/ops/cargo_compile.rs b/src/cargo/ops/cargo_compile.rs index 4ff4e240d..dcb3acfbc 100644 --- a/src/cargo/ops/cargo_compile.rs +++ b/src/cargo/ops/cargo_compile.rs @@ -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) } } diff --git a/tests/testsuite/build.rs b/tests/testsuite/build.rs index 9dfafc133..51b449af5 100644 --- a/tests/testsuite/build.rs +++ b/tests/testsuite/build.rs @@ -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)); }