Skip to content

Commit 41900f8

Browse files
Add regression test
1 parent e59a6f8 commit 41900f8

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

tests/ui/check-cfg/cfg-select.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
//@ check-pass
2+
3+
#![feature(cfg_select)]
4+
#![crate_type = "lib"]
5+
6+
cfg_select! {
7+
true => {}
8+
invalid_cfg1 => {}
9+
//~^ WARN unexpected `cfg` condition name
10+
_ => {}
11+
}
12+
13+
cfg_select! {
14+
invalid_cfg2 => {}
15+
//~^ WARN unexpected `cfg` condition name
16+
true => {}
17+
_ => {}
18+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
warning: unexpected `cfg` condition name: `invalid_cfg1`
2+
--> $DIR/cfg-select.rs:8:5
3+
|
4+
LL | invalid_cfg1 => {}
5+
| ^^^^^^^^^^^^
6+
|
7+
= help: expected names are: `FALSE` and `test` and 31 more
8+
= help: to expect this configuration use `--check-cfg=cfg(invalid_cfg1)`
9+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
10+
= note: `#[warn(unexpected_cfgs)]` on by default
11+
12+
warning: unexpected `cfg` condition name: `invalid_cfg2`
13+
--> $DIR/cfg-select.rs:14:5
14+
|
15+
LL | invalid_cfg2 => {}
16+
| ^^^^^^^^^^^^
17+
|
18+
= help: to expect this configuration use `--check-cfg=cfg(invalid_cfg2)`
19+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
20+
21+
warning: 2 warnings emitted
22+

0 commit comments

Comments
 (0)