File: mix.rs

package info (click to toggle)
rustc 1.85.0%2Bdfsg3-1
  • links: PTS, VCS
  • area: main
  • in suites: experimental, forky, sid, trixie, trixie-backports, trixie-proposed-updates
  • size: 893,396 kB
  • sloc: xml: 158,127; python: 35,830; javascript: 19,497; cpp: 19,002; sh: 17,245; ansic: 13,127; asm: 4,376; makefile: 1,051; perl: 29; lisp: 29; ruby: 19; sql: 11
file content (80 lines) | stat: -rw-r--r-- 2,536 bytes parent folder | download | duplicates (15)
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
// This test checks the combination of well known names, the usage of cfg(),
// and that no implicit cfgs is added from --cfg while also testing that
// we correctly lint on the `cfg!` macro and `cfg_attr` attribute.
//
//@ check-pass
//@ no-auto-check-cfg
//@ compile-flags: --cfg feature="bar" --cfg unknown_name
//@ compile-flags: --check-cfg=cfg(feature,values("foo"))

#[cfg(windows)]
fn do_windows_stuff() {}

#[cfg(widnows)]
//~^ WARNING unexpected `cfg` condition name
fn do_windows_stuff() {}

#[cfg(feature)]
//~^ WARNING unexpected `cfg` condition value
fn no_feature() {}

#[cfg(feature = "foo")]
fn use_foo() {}

#[cfg(feature = "bar")]
//~^ WARNING unexpected `cfg` condition value
fn use_bar() {}

#[cfg(feature = "zebra")]
//~^ WARNING unexpected `cfg` condition value
fn use_zebra() {}

#[cfg_attr(uu, unix)]
//~^ WARNING unexpected `cfg` condition name
fn do_test() {}

#[cfg_attr(feature = "foo", no_mangle)]
fn do_test_foo() {}

fn test_cfg_macro() {
    cfg!(windows);
    cfg!(widnows);
    //~^ WARNING unexpected `cfg` condition name
    cfg!(feature = "foo");
    cfg!(feature = "bar");
    //~^ WARNING unexpected `cfg` condition value
    cfg!(feature = "zebra");
    //~^ WARNING unexpected `cfg` condition value
    cfg!(xxx = "foo");
    //~^ WARNING unexpected `cfg` condition name
    cfg!(xxx);
    //~^ WARNING unexpected `cfg` condition name
    cfg!(any(xxx, windows));
    //~^ WARNING unexpected `cfg` condition name
    cfg!(any(feature = "bad", windows));
    //~^ WARNING unexpected `cfg` condition value
    cfg!(any(windows, xxx));
    //~^ WARNING unexpected `cfg` condition name
    cfg!(all(unix, xxx));
    //~^ WARNING unexpected `cfg` condition name
    cfg!(all(aa, bb));
    //~^ WARNING unexpected `cfg` condition name
    //~| WARNING unexpected `cfg` condition name
    cfg!(any(aa, bb));
    //~^ WARNING unexpected `cfg` condition name
    //~| WARNING unexpected `cfg` condition name
    cfg!(any(unix, feature = "zebra"));
    //~^ WARNING unexpected `cfg` condition value
    cfg!(any(xxx, feature = "zebra"));
    //~^ WARNING unexpected `cfg` condition name
    //~| WARNING unexpected `cfg` condition value
    cfg!(any(xxx, unix, xxx));
    //~^ WARNING unexpected `cfg` condition name
    //~| WARNING unexpected `cfg` condition name
    cfg!(all(feature = "zebra", feature = "zebra", feature = "zebra"));
    //~^ WARNING unexpected `cfg` condition value
    //~| WARNING unexpected `cfg` condition value
    //~| WARNING unexpected `cfg` condition value
}

fn main() {}