From 2166db8c49e067732d343eeeb1b9c0813019561d Mon Sep 17 00:00:00 2001 From: Jonas Platte Date: Tue, 24 Dec 2019 13:29:38 +0100 Subject: [PATCH] Add a note to the error message for using --feature / --no-default-features in a virtual workspace --- src/cargo/util/command_prelude.rs | 3 ++- tests/testsuite/features.rs | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/cargo/util/command_prelude.rs b/src/cargo/util/command_prelude.rs index bc233096a7f..d80610813d8 100644 --- a/src/cargo/util/command_prelude.rs +++ b/src/cargo/util/command_prelude.rs @@ -289,7 +289,8 @@ pub trait ArgMatchesExt { for flag in &["features", "no-default-features"] { if self._is_present(flag) { bail!( - "--{} is not allowed in the root of a virtual workspace", + "--{} is not allowed in the root of a virtual workspace\n\ + note: while this was previously accepted, it didn't actually do anything", flag ); } diff --git a/tests/testsuite/features.rs b/tests/testsuite/features.rs index 128c3ae3305..98cbbed89a5 100644 --- a/tests/testsuite/features.rs +++ b/tests/testsuite/features.rs @@ -2017,13 +2017,17 @@ fn virtual_ws_flags() { .build(); p.cargo("build --features=f1") - .with_stderr("[ERROR] --features is not allowed in the root of a virtual workspace") + .with_stderr( + "[ERROR] --features is not allowed in the root of a virtual workspace\n\ + note: while this was previously accepted, it didn't actually do anything", + ) .with_status(101) .run(); p.cargo("build --no-default-features") .with_stderr( - "[ERROR] --no-default-features is not allowed in the root of a virtual workspace", + "[ERROR] --no-default-features is not allowed in the root of a virtual workspace\n\ + note: while this was previously accepted, it didn't actually do anything", ) .with_status(101) .run();