]> git.lizzy.rs Git - rust.git/blob - tests/target/struct-field-attributes.rs
Merge pull request #2058 from BenjaminGill-Metaswitch/patch-1
[rust.git] / tests / target / struct-field-attributes.rs
1 // #1535
2 #![feature(struct_field_attributes)]
3
4 struct Foo {
5     bar: u64,
6
7     #[cfg(test)] qux: u64,
8 }
9
10 fn do_something() -> Foo {
11     Foo {
12         bar: 0,
13
14         #[cfg(test)]
15         qux: 1,
16     }
17 }
18
19 fn main() {
20     do_something();
21 }
22
23 // #1462
24 struct Foo {
25     foo: usize,
26     #[cfg(feature = "include-bar")] bar: usize,
27 }
28
29 fn new_foo() -> Foo {
30     Foo {
31         foo: 0,
32         #[cfg(feature = "include-bar")]
33         bar: 0,
34     }
35 }
36
37 // #2044
38 pub enum State {
39     Closure(
40         #[cfg_attr(feature = "serde_derive", serde(state_with = "::serialization::closure"))]
41         GcPtr<ClosureData>,
42     ),
43 }
44
45 struct Fields(
46     #[cfg_attr(feature = "serde_derive", serde(state_with = "::base::serialization::shared"))]
47     Arc<Vec<InternedStr>>,
48 );