Skip to content

Commit

Permalink
Auto merge of #8773 - pickfire:patch-1, r=ehuss
Browse files Browse the repository at this point in the history
Add actionable help message for --features

Fix #8770
  • Loading branch information
bors committed Oct 14, 2020
2 parents 40b7793 + fd5902c commit 655e122
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 1 addition & 0 deletions crates/cargo-test-support/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1521,6 +1521,7 @@ fn substitute_macros(input: &str) -> String {
("[ERROR]", "error:"),
("[WARNING]", "warning:"),
("[NOTE]", "note:"),
("[HELP]", "help:"),
("[DOCUMENTING]", " Documenting"),
("[FRESH]", " Fresh"),
("[UPDATING]", " Updating"),
Expand Down
3 changes: 2 additions & 1 deletion src/cargo/util/command_prelude.rs
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,8 @@ pub trait ArgMatchesExt {
if self._is_present(flag) {
bail!(
"--{} is not allowed in the root of a virtual workspace\n\
note: while this was previously accepted, it didn't actually do anything",
note: while this was previously accepted, it didn't actually do anything\n\
help: change the current directory to the package directory, or use the --manifest-path flag to the path of the package",
flag
);
}
Expand Down
6 changes: 4 additions & 2 deletions tests/testsuite/features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1939,15 +1939,17 @@ fn virtual_ws_flags() {
p.cargo("build --features=f1")
.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",
[NOTE] while this was previously accepted, it didn't actually do anything\n\
[HELP] change the current directory to the package directory, or use the --manifest-path flag to the path of the package",
)
.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\n\
note: while this was previously accepted, it didn't actually do anything",
[NOTE] while this was previously accepted, it didn't actually do anything\n\
[HELP] change the current directory to the package directory, or use the --manifest-path flag to the path of the package",
)
.with_status(101)
.run();
Expand Down
4 changes: 4 additions & 0 deletions tests/testsuite/package_features.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ fn virtual_no_default_features() {
"\
[ERROR] --no-default-features is not allowed in the root of a virtual workspace
[NOTE] while this was previously accepted, it didn't actually do anything
[HELP] change the current directory to the package directory, or use the --manifest-path flag to the path of the package
",
)
.run();
Expand Down Expand Up @@ -125,6 +126,7 @@ fn virtual_features() {
"\
[ERROR] --features is not allowed in the root of a virtual workspace
[NOTE] while this was previously accepted, it didn't actually do anything
[HELP] change the current directory to the package directory, or use the --manifest-path flag to the path of the package
",
)
.run();
Expand Down Expand Up @@ -202,6 +204,7 @@ fn virtual_with_specific() {
"\
[ERROR] --features is not allowed in the root of a virtual workspace
[NOTE] while this was previously accepted, it didn't actually do anything
[HELP] change the current directory to the package directory, or use the --manifest-path flag to the path of the package
",
)
.run();
Expand Down Expand Up @@ -371,6 +374,7 @@ fn virtual_member_slash() {
"\
[ERROR] --features is not allowed in the root of a virtual workspace
[NOTE] while this was previously accepted, it didn't actually do anything
[HELP] change the current directory to the package directory, or use the --manifest-path flag to the path of the package
",
)
.run();
Expand Down

0 comments on commit 655e122

Please sign in to comment.