1 // This test checks the combination of well known names, their activation via names(), the usage of
2 // partial values() with a --cfg and test that we also correctly lint on the `cfg!` macro and
3 // `cfg_attr` attribute.
6 // compile-flags: --check-cfg=names() --check-cfg=values(feature,"foo") --cfg feature="bar" -Z unstable-options
9 fn do_windows_stuff() {}
12 //~^ WARNING unexpected `cfg` condition name
13 fn do_windows_stuff() {}
15 #[cfg(feature = "foo")]
18 #[cfg(feature = "bar")]
21 #[cfg(feature = "zebra")]
22 //~^ WARNING unexpected `cfg` condition value
26 //~^ WARNING unexpected `cfg` condition name
29 #[cfg_attr(feature = "foo", no_mangle)]
35 //~^ WARNING unexpected `cfg` condition name
36 cfg!(feature = "foo");
37 cfg!(feature = "bar");
38 cfg!(feature = "zebra");
39 //~^ WARNING unexpected `cfg` condition value
41 //~^ WARNING unexpected `cfg` condition name
43 //~^ WARNING unexpected `cfg` condition name
44 cfg!(any(xxx, windows));
45 //~^ WARNING unexpected `cfg` condition name
46 cfg!(any(feature = "bad", windows));
47 //~^ WARNING unexpected `cfg` condition value
48 cfg!(any(windows, xxx));
49 //~^ WARNING unexpected `cfg` condition name
51 //~^ WARNING unexpected `cfg` condition name
53 //~^ WARNING unexpected `cfg` condition name
54 //~| WARNING unexpected `cfg` condition name
56 //~^ WARNING unexpected `cfg` condition name
57 //~| WARNING unexpected `cfg` condition name
58 cfg!(any(unix, feature = "zebra"));
59 //~^ WARNING unexpected `cfg` condition value
60 cfg!(any(xxx, feature = "zebra"));
61 //~^ WARNING unexpected `cfg` condition name
62 //~| WARNING unexpected `cfg` condition value
63 cfg!(any(xxx, unix, xxx));
64 //~^ WARNING unexpected `cfg` condition name
65 //~| WARNING unexpected `cfg` condition name
66 cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
67 //~^ WARNING unexpected `cfg` condition value
68 //~| WARNING unexpected `cfg` condition value
69 //~| WARNING unexpected `cfg` condition value