about summary refs log tree commit diff
path: root/tests/ui/check-cfg/exhaustive-names-values.rs
blob: 772c78288f8569e906dc833445f11dc3ac72d590 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Check warning for unexpected cfg in the code.
//
//@ check-pass
//@ no-auto-check-cfg
//@ revisions: empty_cfg feature full
//@ [empty_cfg]compile-flags: --check-cfg=cfg()
//@ [feature]compile-flags: --check-cfg=cfg(feature,values("std"))
//@ [full]compile-flags: --check-cfg=cfg(feature,values("std")) --check-cfg=cfg()

#[cfg(unknown_key = "value")]
//~^ WARNING unexpected `cfg` condition name
pub fn f() {}

#[cfg(target_vendor = "value")]
//~^ WARNING unexpected `cfg` condition value
pub fn f() {}

#[cfg(feature = "unk")]
//[empty_cfg]~^ WARNING unexpected `cfg` condition name
//[feature]~^^ WARNING unexpected `cfg` condition value
//[full]~^^^ WARNING unexpected `cfg` condition value
pub fn feat() {}

#[cfg(feature = "std")]
//[empty_cfg]~^ WARNING unexpected `cfg` condition name
pub fn feat() {}

#[cfg(windows)]
pub fn win() {}

#[cfg(unix)]
pub fn unix() {}

fn main() {}