Add test for well known names defined by rustc
This commit is contained in:
parent
da896d35f4
commit
fbe1c153ec
27
src/test/ui/check-cfg/well-known-names.rs
Normal file
27
src/test/ui/check-cfg/well-known-names.rs
Normal file
@ -0,0 +1,27 @@
|
||||
// This test checks that we lint on non well known names and that we don't lint on well known names
|
||||
//
|
||||
// check-pass
|
||||
// compile-flags: --check-cfg=names() -Z unstable-options
|
||||
|
||||
#[cfg(target_oz = "linux")]
|
||||
//~^ WARNING unexpected `cfg` condition name
|
||||
fn target_os_misspell() {}
|
||||
|
||||
#[cfg(target_os = "linux")]
|
||||
fn target_os() {}
|
||||
|
||||
#[cfg(features = "foo")]
|
||||
//~^ WARNING unexpected `cfg` condition name
|
||||
fn feature_misspell() {}
|
||||
|
||||
#[cfg(feature = "foo")]
|
||||
fn feature() {}
|
||||
|
||||
#[cfg(uniw)]
|
||||
//~^ WARNING unexpected `cfg` condition name
|
||||
fn unix_misspell() {}
|
||||
|
||||
#[cfg(unix)]
|
||||
fn unix() {}
|
||||
|
||||
fn main() {}
|
22
src/test/ui/check-cfg/well-known-names.stderr
Normal file
22
src/test/ui/check-cfg/well-known-names.stderr
Normal file
@ -0,0 +1,22 @@
|
||||
warning: unexpected `cfg` condition name
|
||||
--> $DIR/well-known-names.rs:6:7
|
||||
|
|
||||
LL | #[cfg(target_oz = "linux")]
|
||||
| ^^^^^^^^^^^^^^^^^^^
|
||||
|
|
||||
= note: `#[warn(unexpected_cfgs)]` on by default
|
||||
|
||||
warning: unexpected `cfg` condition name
|
||||
--> $DIR/well-known-names.rs:13:7
|
||||
|
|
||||
LL | #[cfg(features = "foo")]
|
||||
| ^^^^^^^^^^^^^^^^
|
||||
|
||||
warning: unexpected `cfg` condition name
|
||||
--> $DIR/well-known-names.rs:20:7
|
||||
|
|
||||
LL | #[cfg(uniw)]
|
||||
| ^^^^
|
||||
|
||||
warning: 3 warnings emitted
|
||||
|
Loading…
x
Reference in New Issue
Block a user