-
Notifications
You must be signed in to change notification settings - Fork 12.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MCP636: Adapt check-cfg tests to the new syntax
- Loading branch information
Showing
68 changed files
with
749 additions
and
124 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
// check-fail | ||
// compile-flags: --check-cfg=names() | ||
// compile-flags: --check-cfg=cfg() |
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=cfg(my_cfg,values("foo")) --check-cfg=cfg(my_cfg,values("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: (none) | ||
--> $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: `unk` | ||
--> $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.
25 changes: 25 additions & 0 deletions
25
tests/ui/check-cfg/exhaustive-names-values.empty_cfg.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,25 @@ | ||
warning: unexpected `cfg` condition name: `unknown_key` | ||
--> $DIR/exhaustive-names-values.rs:12:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `cfg` condition value: `value` | ||
--> $DIR/exhaustive-names-values.rs:16:7 | ||
| | ||
LL | #[cfg(test = "value")] | ||
| ^^^^---------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `test` | ||
|
||
warning: unexpected `empty_cfg` as condition name | ||
| | ||
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names | ||
|
||
warning: 3 warnings emitted | ||
|
25 changes: 25 additions & 0 deletions
25
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,25 @@ | ||
warning: unexpected `cfg` condition name: `unknown_key` | ||
--> $DIR/exhaustive-names-values.rs:12:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `cfg` condition value: `value` | ||
--> $DIR/exhaustive-names-values.rs:16: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 | ||
|
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,33 @@ | ||
warning: unexpected `cfg` condition name: `unknown_key` | ||
--> $DIR/exhaustive-names-values.rs:12:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `cfg` condition value: `value` | ||
--> $DIR/exhaustive-names-values.rs:16:7 | ||
| | ||
LL | #[cfg(test = "value")] | ||
| ^^^^---------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `test` | ||
|
||
warning: unexpected `cfg` condition value: `unk` | ||
--> $DIR/exhaustive-names-values.rs:20:7 | ||
| | ||
LL | #[cfg(feature = "unk")] | ||
| ^^^^^^^^^^^^^^^ | ||
| | ||
= note: expected values for `feature` are: `std` | ||
|
||
warning: unexpected condition value `` for condition name `feature` | ||
| | ||
= help: was set with `--cfg` but isn't in the `--check-cfg` expected values | ||
|
||
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,33 @@ | ||
warning: unexpected `cfg` condition name: `unknown_key` | ||
--> $DIR/exhaustive-names-values.rs:12:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `cfg` condition value: `value` | ||
--> $DIR/exhaustive-names-values.rs:16:7 | ||
| | ||
LL | #[cfg(test = "value")] | ||
| ^^^^---------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `test` | ||
|
||
warning: unexpected `cfg` condition value: `unk` | ||
--> $DIR/exhaustive-names-values.rs:20: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,34 @@ | ||
// Check warning for unexpected cfg in the code and in the CLI | ||
// arguments (here the revision cfg). | ||
// | ||
// check-pass | ||
// revisions: empty_names_values empty_cfg feature full | ||
// compile-flags: -Z unstable-options | ||
// [empty_names_values]compile-flags: --check-cfg=names() --check-cfg=values() | ||
// [empty_cfg]compile-flags: --check-cfg=cfg() | ||
// [feature]compile-flags: --check-cfg=cfg(feature,values("std")) | ||
// [full]compile-flags: --check-cfg=cfg(feature,values("std")) --check-cfg=cfg() | ||
|
||
#[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")] | ||
//[feature]~^ WARNING unexpected `cfg` condition value | ||
//[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() {} |
8 changes: 6 additions & 2 deletions
8
tests/ui/check-cfg/empty-names.stderr → ...k-cfg/exhaustive-names.empty_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 |
---|---|---|
@@ -1,11 +1,15 @@ | ||
warning: unexpected `cfg` condition name: `unknown_key` | ||
--> $DIR/empty-names.rs:6:7 | ||
--> $DIR/exhaustive-names.rs:8:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: 1 warning emitted | ||
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 | ||
|
15 changes: 15 additions & 0 deletions
15
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,15 @@ | ||
warning: unexpected `cfg` condition name: `unknown_key` | ||
--> $DIR/exhaustive-names.rs:8:7 | ||
| | ||
LL | #[cfg(unknown_key = "value")] | ||
| ^^^^^^^^^^^^^^^^^^^^^ | ||
| | ||
= help: expected names are: `debug_assertions`, `doc`, `doctest`, `feature`, `miri`, `overflow_checks`, `panic`, `proc_macro`, `relocation_model`, `sanitize`, `target_abi`, `target_arch`, `target_endian`, `target_env`, `target_family`, `target_feature`, `target_has_atomic`, `target_has_atomic_equal_alignment`, `target_has_atomic_load_store`, `target_os`, `target_pointer_width`, `target_thread_local`, `target_vendor`, `test`, `unix`, `windows` | ||
= 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=cfg() -Z unstable-options | ||
|
||
#[cfg(unknown_key = "value")] | ||
//~^ WARNING unexpected `cfg` condition name | ||
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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
warning: unexpected `cfg` condition value: `value` | ||
--> $DIR/exhaustive-values.rs:9:7 | ||
| | ||
LL | #[cfg(test = "value")] | ||
| ^^^^---------- | ||
| | | ||
| help: remove the value | ||
| | ||
= note: no expected value for `test` | ||
= note: `#[warn(unexpected_cfgs)]` on by default | ||
|
||
warning: unexpected `empty_cfg` as condition name | ||
| | ||
= help: was set with `--cfg` but isn't in the `--check-cfg` expected names | ||
|
||
warning: 2 warnings emitted | ||
|
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
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 warning for unexpected cfg value | ||
// | ||
// check-pass | ||
// revisions: empty_values empty_cfg without_names | ||
// [empty_values]compile-flags: --check-cfg=values() -Z unstable-options | ||
// [empty_cfg]compile-flags: --check-cfg=cfg() -Z unstable-options | ||
// [without_names]compile-flags: --check-cfg=cfg(any()) -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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
warning: unexpected `cfg` condition value: `value` | ||
--> $DIR/exhaustive-values.rs:9: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 | ||
|
Oops, something went wrong.