]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/cfg_attr.rs
rollup merge of #20642: michaelwoerister/sane-source-locations-pt1
[rust.git] / src / test / run-pass / cfg_attr.rs
1 // Copyright 2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // compile-flags:--cfg set1 --cfg set2
12 #![allow(dead_code)]
13 use std::fmt::Debug;
14
15 struct NotDebugable;
16
17 #[cfg_attr(set1, derive(Debug))]
18 struct Set1;
19
20 #[cfg_attr(notset, derive(Debug))]
21 struct Notset(NotDebugable);
22
23 #[cfg_attr(not(notset), derive(Debug))]
24 struct NotNotset;
25
26 #[cfg_attr(not(set1), derive(Debug))]
27 struct NotSet1(NotDebugable);
28
29 #[cfg_attr(all(set1, set2), derive(Debug))]
30 struct AllSet1Set2;
31
32 #[cfg_attr(all(set1, notset), derive(Debug))]
33 struct AllSet1Notset(NotDebugable);
34
35 #[cfg_attr(any(set1, notset), derive(Debug))]
36 struct AnySet1Notset;
37
38 #[cfg_attr(any(notset, notset2), derive(Debug))]
39 struct AnyNotsetNotset2(NotDebugable);
40
41 #[cfg_attr(all(not(notset), any(set1, notset)), derive(Debug))]
42 struct Complex;
43
44 #[cfg_attr(any(notset, not(any(set1, notset))), derive(Debug))]
45 struct ComplexNot(NotDebugable);
46
47 #[cfg_attr(any(target_endian = "little", target_endian = "big"), derive(Debug))]
48 struct KeyValue;
49
50 fn is_show<T: Debug>() {}
51
52 fn main() {
53     is_show::<Set1>();
54     is_show::<NotNotset>();
55     is_show::<AllSet1Set2>();
56     is_show::<AnySet1Notset>();
57     is_show::<Complex>();
58     is_show::<KeyValue>();
59 }