Skip to content

Commit 2166db8

Browse files
committed
Add a note to the error message for using --feature / --no-default-features in a virtual workspace
1 parent 86134e7 commit 2166db8

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/cargo/util/command_prelude.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ pub trait ArgMatchesExt {
289289
for flag in &["features", "no-default-features"] {
290290
if self._is_present(flag) {
291291
bail!(
292-
"--{} is not allowed in the root of a virtual workspace",
292+
"--{} is not allowed in the root of a virtual workspace\n\
293+
note: while this was previously accepted, it didn't actually do anything",
293294
flag
294295
);
295296
}

tests/testsuite/features.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2017,13 +2017,17 @@ fn virtual_ws_flags() {
20172017
.build();
20182018

20192019
p.cargo("build --features=f1")
2020-
.with_stderr("[ERROR] --features is not allowed in the root of a virtual workspace")
2020+
.with_stderr(
2021+
"[ERROR] --features is not allowed in the root of a virtual workspace\n\
2022+
note: while this was previously accepted, it didn't actually do anything",
2023+
)
20212024
.with_status(101)
20222025
.run();
20232026

20242027
p.cargo("build --no-default-features")
20252028
.with_stderr(
2026-
"[ERROR] --no-default-features is not allowed in the root of a virtual workspace",
2029+
"[ERROR] --no-default-features is not allowed in the root of a virtual workspace\n\
2030+
note: while this was previously accepted, it didn't actually do anything",
20272031
)
20282032
.with_status(101)
20292033
.run();

0 commit comments

Comments
 (0)