]> git.proxmox.com Git - rustc.git/blame - src/test/ui/cfg/cfg_attr.rs
New upstream version 1.50.0+dfsg1
[rustc.git] / src / test / ui / cfg / cfg_attr.rs
CommitLineData
b7449926 1// run-pass
1a4d82fc
JJ
2// compile-flags:--cfg set1 --cfg set2
3#![allow(dead_code)]
85aaf69f 4use std::fmt::Debug;
1a4d82fc 5
85aaf69f 6struct NotDebugable;
1a4d82fc 7
85aaf69f 8#[cfg_attr(set1, derive(Debug))]
1a4d82fc
JJ
9struct Set1;
10
85aaf69f
SL
11#[cfg_attr(notset, derive(Debug))]
12struct Notset(NotDebugable);
1a4d82fc 13
85aaf69f 14#[cfg_attr(not(notset), derive(Debug))]
1a4d82fc
JJ
15struct NotNotset;
16
85aaf69f
SL
17#[cfg_attr(not(set1), derive(Debug))]
18struct NotSet1(NotDebugable);
1a4d82fc 19
85aaf69f 20#[cfg_attr(all(set1, set2), derive(Debug))]
1a4d82fc
JJ
21struct AllSet1Set2;
22
85aaf69f
SL
23#[cfg_attr(all(set1, notset), derive(Debug))]
24struct AllSet1Notset(NotDebugable);
1a4d82fc 25
85aaf69f 26#[cfg_attr(any(set1, notset), derive(Debug))]
1a4d82fc
JJ
27struct AnySet1Notset;
28
85aaf69f
SL
29#[cfg_attr(any(notset, notset2), derive(Debug))]
30struct AnyNotsetNotset2(NotDebugable);
1a4d82fc 31
85aaf69f 32#[cfg_attr(all(not(notset), any(set1, notset)), derive(Debug))]
1a4d82fc
JJ
33struct Complex;
34
85aaf69f
SL
35#[cfg_attr(any(notset, not(any(set1, notset))), derive(Debug))]
36struct ComplexNot(NotDebugable);
1a4d82fc 37
85aaf69f 38#[cfg_attr(any(target_endian = "little", target_endian = "big"), derive(Debug))]
1a4d82fc
JJ
39struct KeyValue;
40
85aaf69f 41fn is_show<T: Debug>() {}
1a4d82fc
JJ
42
43fn main() {
44 is_show::<Set1>();
45 is_show::<NotNotset>();
46 is_show::<AllSet1Set2>();
47 is_show::<AnySet1Notset>();
48 is_show::<Complex>();
49 is_show::<KeyValue>();
50}