]> git.proxmox.com Git - rustc.git/blame - src/tools/rustfmt/tests/target/struct-field-attributes.rs
New upstream version 1.52.1+dfsg1
[rustc.git] / src / tools / rustfmt / tests / target / struct-field-attributes.rs
CommitLineData
f20569fa
XL
1// #1535
2#![feature(struct_field_attributes)]
3
4struct Foo {
5 bar: u64,
6
7 #[cfg(test)]
8 qux: u64,
9}
10
11fn do_something() -> Foo {
12 Foo {
13 bar: 0,
14
15 #[cfg(test)]
16 qux: 1,
17 }
18}
19
20fn main() {
21 do_something();
22}
23
24// #1462
25struct Foo {
26 foo: usize,
27 #[cfg(feature = "include-bar")]
28 bar: usize,
29}
30
31fn new_foo() -> Foo {
32 Foo {
33 foo: 0,
34 #[cfg(feature = "include-bar")]
35 bar: 0,
36 }
37}
38
39// #2044
40pub enum State {
41 Closure(
42 #[cfg_attr(
43 feature = "serde_derive",
44 serde(state_with = "::serialization::closure")
45 )]
46 GcPtr<ClosureData>,
47 ),
48}
49
50struct Fields(
51 #[cfg_attr(
52 feature = "serde_derive",
53 serde(state_with = "::base::serialization::shared")
54 )]
55 Arc<Vec<InternedStr>>,
56);
57
58// #2309
59pub struct A {
60 #[doc = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"]
61 pub foos: Vec<bool>,
62}