Skip to content

Commit 557fcb0

Browse files
Add regression test
1 parent 5010285 commit 557fcb0

File tree

2 files changed

+31
-1
lines changed

2 files changed

+31
-1
lines changed

tests/ui/macros/cfg_select.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,3 +97,15 @@ cfg_select! {
9797
//~^ ERROR expected one of `(`, `::`, `=>`, or `=`, found `!`
9898
//~| WARN unexpected `cfg` condition name
9999
}
100+
101+
cfg_select! {
102+
true => {}
103+
invalid_cfg1 => {} //~ WARN unexpected `cfg` condition name
104+
_ => {}
105+
}
106+
107+
cfg_select! {
108+
invalid_cfg2 => {} //~ WARN unexpected `cfg` condition name
109+
true => {}
110+
_ => {}
111+
}

tests/ui/macros/cfg_select.stderr

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,25 @@ LL | cfg!() => {}
8585
= help: to expect this configuration use `--check-cfg=cfg(cfg)`
8686
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
8787

88-
error: aborting due to 9 previous errors; 3 warnings emitted
88+
warning: unexpected `cfg` condition name: `invalid_cfg1`
89+
--> $DIR/cfg_select.rs:103:5
90+
|
91+
LL | invalid_cfg1 => {}
92+
| ^^^^^^^^^^^^
93+
|
94+
= help: to expect this configuration use `--check-cfg=cfg(invalid_cfg1)`
95+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
96+
97+
warning: unexpected `cfg` condition name: `invalid_cfg2`
98+
--> $DIR/cfg_select.rs:108:5
99+
|
100+
LL | invalid_cfg2 => {}
101+
| ^^^^^^^^^^^^
102+
|
103+
= help: to expect this configuration use `--check-cfg=cfg(invalid_cfg2)`
104+
= note: see <https://doc.rust-lang.org/nightly/rustc/check-cfg.html> for more information about checking conditional configuration
105+
106+
error: aborting due to 9 previous errors; 5 warnings emitted
89107

90108
Some errors have detailed explanations: E0537, E0539.
91109
For more information about an error, try `rustc --explain E0537`.

0 commit comments

Comments
 (0)