-
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.
Add explicit none() value variant in check-cfg
- Loading branch information
Showing
12 changed files
with
99 additions
and
5 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
error: invalid `--check-cfg` argument: `cfg(none())` (`cfg()` arguments must be simple identifiers, `any()` or `values(...)`) | ||
|
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,2 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(bar))` (`values()` arguments must be string literals or `any()`) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(bar))` (`values()` arguments must be string literals, `none()` or `any()`) | ||
|
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,2 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values("bar",bar,"bar"))` (`values()` arguments must be string literals or `any()`) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values("bar",bar,"bar"))` (`values()` arguments must be string literals, `none()` or `any()`) | ||
|
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,2 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(none("test")))` (`none()` must be empty) | ||
|
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
2 changes: 1 addition & 1 deletion
2
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,2 @@ | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(test()))` (`values()` arguments must be string literals or `any()`) | ||
error: invalid `--check-cfg` argument: `cfg(foo,values(test()))` (`values()` arguments must be string literals, `none()` or `any()`) | ||
|
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
warning: unexpected `cfg` condition value: `too` | ||
--> $DIR/values-none.rs:11:7 | ||
| | ||
LL | #[cfg(foo = "too")] | ||
| ^^^-------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `foo` | ||
= help: to expect this configuration use `--check-cfg=cfg(foo, values("too"))` | ||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `cfg` condition value: `bar` | ||
--> $DIR/values-none.rs:16:7 | ||
| | ||
LL | #[cfg(foo = "bar")] | ||
| ^^^-------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `foo` | ||
= help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))` | ||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration | ||
|
||
warning: 2 warnings emitted | ||
|
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,27 @@ | ||
warning: unexpected `cfg` condition value: `too` | ||
--> $DIR/values-none.rs:11:7 | ||
| | ||
LL | #[cfg(foo = "too")] | ||
| ^^^-------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `foo` | ||
= help: to expect this configuration use `--check-cfg=cfg(foo, values("too"))` | ||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `cfg` condition value: `bar` | ||
--> $DIR/values-none.rs:16:7 | ||
| | ||
LL | #[cfg(foo = "bar")] | ||
| ^^^-------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `foo` | ||
= help: to expect this configuration use `--check-cfg=cfg(foo, values("bar"))` | ||
= note: see <https://doc.rust-lang.org/nightly/unstable-book/compiler-flags/check-cfg.html> for more information about checking conditional configuration | ||
|
||
warning: 2 warnings emitted | ||
|
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,23 @@ | ||
// check-pass | ||
// | ||
// revisions: explicit implicit | ||
// compile-flags: -Zunstable-options | ||
// [explicit]compile-flags: --check-cfg=cfg(foo,values(none())) | ||
// [implicit]compile-flags: --check-cfg=cfg(foo) | ||
// [simple] compile-flags: --check-cfg=cfg(foo,values(none(),"too")) | ||
// [concat_1]compile-flags: --check-cfg=cfg(foo) --check-cfg=cfg(foo,values("too")) | ||
// [concat_2]compile-flags: --check-cfg=cfg(foo,values("too")) --check-cfg=cfg(foo) | ||
|
||
#[cfg(foo = "too")] | ||
//[explicit]~^ WARNING unexpected `cfg` condition value | ||
//[implicit]~^^ WARNING unexpected `cfg` condition value | ||
fn foo_too() {} | ||
|
||
#[cfg(foo = "bar")] | ||
//~^ WARNING unexpected `cfg` condition value | ||
fn foo_bar() {} | ||
|
||
#[cfg(foo)] | ||
fn foo() {} | ||
|
||
fn main() {} |