]> git.lizzy.rs Git - rust.git/blob - src/test/ui/print_type_sizes/zero-sized-fields.rs
:arrow_up: rust-analyzer
[rust.git] / src / test / ui / print_type_sizes / zero-sized-fields.rs
1 // compile-flags: -Z print-type-sizes
2 // build-pass
3 // ignore-pass
4
5 // At one point, zero-sized fields such as those in this file were causing
6 // incorrect output from `-Z print-type-sizes`.
7
8 #![feature(start)]
9
10 struct S1 {
11     x: u32,
12     y: u32,
13     tag: (),
14 }
15
16 struct Void();
17 struct Empty {}
18
19 struct S5<TagW, TagZ> {
20     tagw: TagW,
21     w: u32,
22     unit: (),
23     x: u32,
24     void: Void,
25     y: u32,
26     empty: Empty,
27     z: u32,
28     tagz: TagZ,
29 }
30
31 #[start]
32 fn start(_: isize, _: *const *const u8) -> isize {
33     let _s1: S1 = S1 { x: 0, y: 0, tag: () };
34
35     let _s5: S5<(), Empty> = S5 {
36         tagw: (),
37         w: 1,
38         unit: (),
39         x: 2,
40         void: Void(),
41         y: 3,
42         empty: Empty {},
43         z: 4,
44         tagz: Empty {},
45     };
46     0
47 }