-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve check-cfg CLI errors with more structured diagnostics
- Loading branch information
Showing
27 changed files
with
150 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `cfg(any(),values())` (`values()` cannot be specified before the names) | ||
error: invalid `--check-cfg` argument: `cfg(any(),values())` | ||
| | ||
= note: `values()` cannot be specified before the names | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `anything_else(...)` (expected `cfg(name, values("value1", "value2", ... "valueN"))`) | ||
error: invalid `--check-cfg` argument: `anything_else(...)` | ||
| | ||
= note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(true)` | ||
| | ||
= note: `true` is a boolean literal | ||
= note: `cfg()` arguments must be simple identifiers, `any()` or `values(...)` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(none())` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`) | ||
error: invalid `--check-cfg` argument: `cfg(none())` | ||
| | ||
= note: `none()` is invalid | ||
= note: `cfg()` arguments must be simple identifiers, `any()` or `values(...)` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `cfg(...)` (expected `cfg(name, values("value1", "value2", ... "valueN"))`) | ||
error: invalid `--check-cfg` argument: `cfg(...)` | ||
| | ||
= note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(bar))` (`values()` arguments must be string literals, `none()` or `any()`) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(bar))` | ||
| | ||
= note: `bar` is invalid | ||
= note: `values()` arguments must be string literals, `none()` or `any()` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values("bar",bar,"bar"))` (`values()` arguments must be string literals, `none()` or `any()`) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values("bar",bar,"bar"))` | ||
| | ||
= note: `bar` is invalid | ||
= note: `values()` arguments must be string literals, `none()` or `any()` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `cfg(any(),values(any()))` (`values()` cannot be specified before the names) | ||
error: invalid `--check-cfg` argument: `cfg(any(),values(any()))` | ||
| | ||
= note: `values()` cannot be specified before the names | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values("bar",any()))` (`values()` arguments cannot specify string literals and `any()` at the same time) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values("bar",any()))` | ||
| | ||
= note: `values()` arguments cannot specify string literals and `any()` at the same time | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `cfg(any(),any())` (`any()` cannot be specified multiple times) | ||
error: invalid `--check-cfg` argument: `cfg(any(),any())` | ||
| | ||
= note: `any()` cannot be specified multiple times | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(),values())` (`values()` cannot be specified multiple times) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(),values())` | ||
| | ||
= note: `values()` cannot be specified multiple times | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
6 changes: 5 additions & 1 deletion
6
tests/ui/check-cfg/invalid-arguments.multiple_values_any.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(any(),any()))` (`any()` in `values()` cannot be specified multiple times) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(any(),any()))` | ||
| | ||
= note: `any()` is invalid | ||
= note: `any()` in `values()` cannot be specified multiple times | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(none("test")))` (`none()` must be empty) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(none("test")))` | ||
| | ||
= note: `none("test")` is invalid | ||
= note: `none()` in `values()` takes no argument | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(any(foo))` (`any()` must be empty) | ||
error: invalid `--check-cfg` argument: `cfg(any(foo))` | ||
| | ||
= note: `any(foo)` is invalid | ||
= note: `any()` takes no argument | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
6 changes: 5 additions & 1 deletion
6
tests/ui/check-cfg/invalid-arguments.not_empty_values_any.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(any(bar)))` (`any()` must be empty) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(any(bar)))` | ||
| | ||
= note: `any(bar)` is invalid | ||
= note: `any()` in `values()` takes no argument | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg("NOT_IDENT")` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`) | ||
error: invalid `--check-cfg` argument: `cfg("NOT_IDENT")` | ||
| | ||
= note: `"NOT_IDENT"` is a string literal | ||
= note: `cfg()` arguments must be simple identifiers, `any()` or `values(...)` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,"NOT_IDENT",bar)` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`) | ||
error: invalid `--check-cfg` argument: `cfg(foo,"NOT_IDENT",bar)` | ||
| | ||
= note: `"NOT_IDENT"` is a string literal | ||
= note: `cfg()` arguments must be simple identifiers, `any()` or `values(...)` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
5 changes: 4 additions & 1 deletion
5
tests/ui/check-cfg/invalid-arguments.unknown_meta_item_1.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `abc()` (expected `cfg(name, values("value1", "value2", ... "valueN"))`) | ||
error: invalid `--check-cfg` argument: `abc()` | ||
| | ||
= note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
6 changes: 5 additions & 1 deletion
6
tests/ui/check-cfg/invalid-arguments.unknown_meta_item_2.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,test())` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`) | ||
error: invalid `--check-cfg` argument: `cfg(foo,test())` | ||
| | ||
= note: `test()` is invalid | ||
= note: `cfg()` arguments must be simple identifiers, `any()` or `values(...)` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
6 changes: 5 additions & 1 deletion
6
tests/ui/check-cfg/invalid-arguments.unknown_meta_item_3.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,6 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(test()))` (`values()` arguments must be string literals, `none()` or `any()`) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(test()))` | ||
| | ||
= note: `test()` is invalid | ||
= note: `values()` arguments must be string literals, `none()` or `any()` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `cfg(` (expected `cfg(name, values("value1", "value2", ... "valueN"))`) | ||
error: invalid `--check-cfg` argument: `cfg(` | ||
| | ||
= note: expected `cfg(name, values("value1", "value2", ... "valueN"))` | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
5 changes: 4 additions & 1 deletion
5
tests/ui/check-cfg/invalid-arguments.values_any_before_ident.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `cfg(values(any()),foo)` (`values()` cannot be specified before the names) | ||
error: invalid `--check-cfg` argument: `cfg(values(any()),foo)` | ||
| | ||
= note: `values()` cannot be specified before the names | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|
5 changes: 4 additions & 1 deletion
5
tests/ui/check-cfg/invalid-arguments.values_any_missing_values.stderr
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,any())` (`cfg(any())` can only be provided in isolation) | ||
error: invalid `--check-cfg` argument: `cfg(foo,any())` | ||
| | ||
= note: `cfg(any())` can only be provided in isolation | ||
= note: visit <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more details | ||
|