Skip to content

Commit fbe1c15

Browse files
committed
Add test for well known names defined by rustc
1 parent da896d3 commit fbe1c15

File tree

2 files changed

+49
-0
lines changed

2 files changed

+49
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// This test checks that we lint on non well known names and that we don't lint on well known names
2+
//
3+
// check-pass
4+
// compile-flags: --check-cfg=names() -Z unstable-options
5+
6+
#[cfg(target_oz = "linux")]
7+
//~^ WARNING unexpected `cfg` condition name
8+
fn target_os_misspell() {}
9+
10+
#[cfg(target_os = "linux")]
11+
fn target_os() {}
12+
13+
#[cfg(features = "foo")]
14+
//~^ WARNING unexpected `cfg` condition name
15+
fn feature_misspell() {}
16+
17+
#[cfg(feature = "foo")]
18+
fn feature() {}
19+
20+
#[cfg(uniw)]
21+
//~^ WARNING unexpected `cfg` condition name
22+
fn unix_misspell() {}
23+
24+
#[cfg(unix)]
25+
fn unix() {}
26+
27+
fn main() {}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
warning: unexpected `cfg` condition name
2+
--> $DIR/well-known-names.rs:6:7
3+
|
4+
LL | #[cfg(target_oz = "linux")]
5+
| ^^^^^^^^^^^^^^^^^^^
6+
|
7+
= note: `#[warn(unexpected_cfgs)]` on by default
8+
9+
warning: unexpected `cfg` condition name
10+
--> $DIR/well-known-names.rs:13:7
11+
|
12+
LL | #[cfg(features = "foo")]
13+
| ^^^^^^^^^^^^^^^^
14+
15+
warning: unexpected `cfg` condition name
16+
--> $DIR/well-known-names.rs:20:7
17+
|
18+
LL | #[cfg(uniw)]
19+
| ^^^^
20+
21+
warning: 3 warnings emitted
22+

0 commit comments

Comments
 (0)