-
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.
Adapt check-cfg tests to the new syntax
- Loading branch information
Showing
47 changed files
with
588 additions
and
101 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
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
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,13 @@ | ||
// check-pass | ||
// compile-flags: -Z unstable-options | ||
// compile-flags: --check-cfg=configure(my_cfg,"foo") --check-cfg=configure(my_cfg,"bar") | ||
|
||
#[cfg(my_cfg)] | ||
//~^ WARNING unexpected `cfg` condition value | ||
fn my_cfg() {} | ||
|
||
#[cfg(my_cfg = "unk")] | ||
//~^ WARNING unexpected `cfg` condition value | ||
fn my_cfg() {} | ||
|
||
fn main() {} |
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,19 @@ | ||
warning: unexpected `cfg` condition value | ||
--> $DIR/concat-values.rs:5:7 | ||
| | ||
LL | #[cfg(my_cfg)] | ||
| ^^^^^^ | ||
| | ||
= note: expected values for `my_cfg` are: `bar`, `foo` | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `cfg` condition value | ||
--> $DIR/concat-values.rs:9:7 | ||
| | ||
LL | #[cfg(my_cfg = "unk")] | ||
| ^^^^^^^^^^^^^^ | ||
| | ||
= note: expected values for `my_cfg` are: `bar`, `foo` | ||
|
||
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
24 changes: 24 additions & 0 deletions
24
tests/ui/check-cfg/exhaustive-names-values.empty_names_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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
warning: unexpected `cfg` condition name | ||
--> $DIR/exhaustive-names-values.rs:10:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `cfg` condition value | ||
--> $DIR/exhaustive-names-values.rs:14:7 | ||
| | ||
LL | #[cfg(test = "value")] | ||
| ^^^^---------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `test` | ||
|
||
warning: unexpected `empty_names_values` as condition name | ||
| | ||
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names | ||
|
||
warning: 3 warnings emitted | ||
|
24 changes: 24 additions & 0 deletions
24
tests/ui/check-cfg/exhaustive-names-values.exhaustive_names_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 |
---|---|---|
@@ -0,0 +1,24 @@ | ||
warning: unexpected `cfg` condition name | ||
--> $DIR/exhaustive-names-values.rs:10:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `cfg` condition value | ||
--> $DIR/exhaustive-names-values.rs:14:7 | ||
| | ||
LL | #[cfg(test = "value")] | ||
| ^^^^---------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `test` | ||
|
||
warning: unexpected `exhaustive_names_values` as condition name | ||
| | ||
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names | ||
|
||
warning: 3 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,32 @@ | ||
warning: unexpected `cfg` condition name | ||
--> $DIR/exhaustive-names-values.rs:10:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `cfg` condition value | ||
--> $DIR/exhaustive-names-values.rs:14:7 | ||
| | ||
LL | #[cfg(test = "value")] | ||
| ^^^^---------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `test` | ||
|
||
warning: unexpected `cfg` condition value | ||
--> $DIR/exhaustive-names-values.rs:18:7 | ||
| | ||
LL | #[cfg(feature = "unk")] | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: expected values for `feature` are: `std` | ||
|
||
warning: unexpected `full` as condition name | ||
| | ||
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names | ||
|
||
warning: 4 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,31 @@ | ||
// Check warning for unexpected cfg | ||
// | ||
// check-pass | ||
// revisions: empty_names_values exhaustive_names_values full | ||
// compile-flags: -Z unstable-options | ||
// [empty_names_values]compile-flags: --check-cfg=names() --check-cfg=values() | ||
// [exhaustive_names_values]compile-flags: --check-cfg=exhaustive(names,values) | ||
// [full]compile-flags: --check-cfg=exhaustive(names,values) --check-cfg=configure(feature,"std") | ||
|
||
#[cfg(unknown_key = "value")] | ||
//~^ WARNING unexpected `cfg` condition name | ||
pub fn f() {} | ||
|
||
#[cfg(test = "value")] | ||
//~^ WARNING unexpected `cfg` condition value | ||
pub fn f() {} | ||
|
||
#[cfg(feature = "unk")] | ||
//[full]~^ WARNING unexpected `cfg` condition value | ||
pub fn feat() {} | ||
|
||
#[cfg(feature = "std")] | ||
pub fn feat() {} | ||
|
||
#[cfg(windows)] | ||
pub fn win() {} | ||
|
||
#[cfg(unix)] | ||
pub fn unix() {} | ||
|
||
fn main() {} |
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,14 @@ | ||
warning: unexpected `cfg` condition name | ||
--> $DIR/exhaustive-names.rs:8:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `empty_names` as condition name | ||
| | ||
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names | ||
|
||
warning: 2 warnings emitted | ||
|
14 changes: 14 additions & 0 deletions
14
tests/ui/check-cfg/exhaustive-names.exhaustive_names.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
warning: unexpected `cfg` condition name | ||
--> $DIR/exhaustive-names.rs:8:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `exhaustive_names` as condition name | ||
| | ||
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names | ||
|
||
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,12 @@ | ||
// Check warning for unexpected cfg | ||
// | ||
// check-pass | ||
// revisions: empty_names exhaustive_names | ||
// [empty_names]compile-flags: --check-cfg=names() -Z unstable-options | ||
// [exhaustive_names]compile-flags: --check-cfg=exhaustive(names) -Z unstable-options | ||
|
||
#[cfg(unknown_key = "value")] | ||
//~^ WARNING unexpected `cfg` condition name | ||
pub fn f() {} | ||
|
||
fn main() {} |
2 changes: 1 addition & 1 deletion
2
tests/ui/check-cfg/empty-values.stderr → ...cfg/exhaustive-values.empty_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
13 changes: 13 additions & 0 deletions
13
tests/ui/check-cfg/exhaustive-values.exhaustive_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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
warning: unexpected `cfg` condition value | ||
--> $DIR/exhaustive-values.rs:8:7 | ||
| | ||
LL | #[cfg(test = "value")] | ||
| ^^^^---------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `test` | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: 1 warning 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,12 @@ | ||
// Check warning for unexpected cfg value | ||
// | ||
// check-pass | ||
// revisions: empty_values exhaustive_values | ||
// [empty_values]compile-flags: --check-cfg=values() -Z unstable-options | ||
// [exhaustive_values]compile-flags: --check-cfg=exhaustive(values) -Z unstable-options | ||
|
||
#[cfg(test = "value")] | ||
//~^ WARNING unexpected `cfg` condition value | ||
pub fn f() {} | ||
|
||
fn main() {} |
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: `anything_else(...)` (expected `names(name1, name2, ... nameN)` or `values(name, "value1", "value2", ... "valueN")`) | ||
error: invalid `--check-cfg` argument: `anything_else(...)` (expected `exhaustive(names, values)` or `configure(name, "value1", "value2", ... "valueN")`) | ||
|
2 changes: 2 additions & 0 deletions
2
tests/ui/check-cfg/invalid-arguments.configure_ident_after.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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
error: invalid `--check-cfg` argument: `configure(foo,"NOT_IDENT",bar)` (`configure()` names cannot be after values) | ||
|
2 changes: 2 additions & 0 deletions
2
tests/ui/check-cfg/invalid-arguments.configure_simple_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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
error: invalid `--check-cfg` argument: `configure("NOT_IDENT")` (`configure()` first arguments must be simple identifiers) | ||
|
2 changes: 2 additions & 0 deletions
2
tests/ui/check-cfg/invalid-arguments.exhaustive_simple_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 |
---|---|---|
@@ -0,0 +1,2 @@ | ||
error: invalid `--check-cfg` argument: `exhaustive("NOT_IDENT")` (`exhaustive()` arguments must be simple identifiers) | ||
|
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
Oops, something went wrong.