]> git.lizzy.rs Git - rust.git/blob - src/test/ui/cfg/cfg_attr.rs
Rollup merge of #105758 - Nilstrieb:typeck-results-mod, r=compiler-errors
[rust.git] / src / test / ui / cfg / cfg_attr.rs
1 // run-pass
2 // compile-flags:--cfg set1 --cfg set2
3 #![allow(dead_code)]
4 use std::fmt::Debug;
5
6 struct NotDebugable;
7
8 #[cfg_attr(set1, derive(Debug))]
9 struct Set1;
10
11 #[cfg_attr(notset, derive(Debug))]
12 struct Notset(NotDebugable);
13
14 #[cfg_attr(not(notset), derive(Debug))]
15 struct NotNotset;
16
17 #[cfg_attr(not(set1), derive(Debug))]
18 struct NotSet1(NotDebugable);
19
20 #[cfg_attr(all(set1, set2), derive(Debug))]
21 struct AllSet1Set2;
22
23 #[cfg_attr(all(set1, notset), derive(Debug))]
24 struct AllSet1Notset(NotDebugable);
25
26 #[cfg_attr(any(set1, notset), derive(Debug))]
27 struct AnySet1Notset;
28
29 #[cfg_attr(any(notset, notset2), derive(Debug))]
30 struct AnyNotsetNotset2(NotDebugable);
31
32 #[cfg_attr(all(not(notset), any(set1, notset)), derive(Debug))]
33 struct Complex;
34
35 #[cfg_attr(any(notset, not(any(set1, notset))), derive(Debug))]
36 struct ComplexNot(NotDebugable);
37
38 #[cfg_attr(any(target_endian = "little", target_endian = "big"), derive(Debug))]
39 struct KeyValue;
40
41 fn is_show<T: Debug>() {}
42
43 fn 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 }