Skip to content

Commit 01576a6

Browse files
Add regression test for nested cfgs
1 parent e7df904 commit 01576a6

File tree

2 files changed

+31
-0
lines changed

2 files changed

+31
-0
lines changed

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//@ check-pass
2+
3+
#[cfg(unknown)] //~ WARN unexpected `cfg` condition name
4+
#[cfg(false)]
5+
#[cfg(unknown)] // Should not warn
6+
fn foo() {}
7+
8+
fn main() {}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
warning: unexpected `cfg` condition name: `unknown`
2+
--> $DIR/nested-cfg.rs:3:7
3+
|
4+
LL | #[cfg(unknown)]
5+
| ^^^^^^^
6+
|
7+
= help: expected names are: `FALSE` and `test` and 31 more
8+
= help: to expect this configuration use `--check-cfg=cfg(unknown)`
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+
help: found config with similar value
12+
|
13+
LL - #[cfg(unknown)]
14+
LL + #[cfg(target_os = "unknown")]
15+
|
16+
help: found config with similar value
17+
|
18+
LL - #[cfg(unknown)]
19+
LL + #[cfg(target_vendor = "unknown")]
20+
|
21+
22+
warning: 1 warning emitted
23+

0 commit comments

Comments
 (0)