]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/tuple-in-struct.rs
Rollup merge of #56476 - GuillaumeGomez:invalid-line-number-match, r=QuietMisdreavus
[rust.git] / src / test / debuginfo / tuple-in-struct.rs
1 // Copyright 2013-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 // ignore-tidy-linelength
12
13 // min-lldb-version: 310
14
15 // compile-flags:-g
16
17 // gdb-command:run
18
19 // gdb-command:print no_padding1
20 // gdbg-check:$1 = {x = {__0 = 0, __1 = 1}, y = 2, z = {__0 = 3, __1 = 4, __2 = 5}}
21 // gdbr-check:$1 = tuple_in_struct::NoPadding1 {x: (0, 1), y: 2, z: (3, 4, 5)}
22 // gdb-command:print no_padding2
23 // gdbg-check:$2 = {x = {__0 = 6, __1 = 7}, y = {__0 = {__0 = 8, __1 = 9}, __1 = 10}}
24 // gdbr-check:$2 = tuple_in_struct::NoPadding2 {x: (6, 7), y: ((8, 9), 10)}
25
26 // gdb-command:print tuple_internal_padding
27 // gdbg-check:$3 = {x = {__0 = 11, __1 = 12}, y = {__0 = 13, __1 = 14}}
28 // gdbr-check:$3 = tuple_in_struct::TupleInternalPadding {x: (11, 12), y: (13, 14)}
29 // gdb-command:print struct_internal_padding
30 // gdbg-check:$4 = {x = {__0 = 15, __1 = 16}, y = {__0 = 17, __1 = 18}}
31 // gdbr-check:$4 = tuple_in_struct::StructInternalPadding {x: (15, 16), y: (17, 18)}
32 // gdb-command:print both_internally_padded
33 // gdbg-check:$5 = {x = {__0 = 19, __1 = 20, __2 = 21}, y = {__0 = 22, __1 = 23}}
34 // gdbr-check:$5 = tuple_in_struct::BothInternallyPadded {x: (19, 20, 21), y: (22, 23)}
35
36 // gdb-command:print single_tuple
37 // gdbg-check:$6 = {x = {__0 = 24, __1 = 25, __2 = 26}}
38 // gdbr-check:$6 = tuple_in_struct::SingleTuple {x: (24, 25, 26)}
39
40 // gdb-command:print tuple_padded_at_end
41 // gdbg-check:$7 = {x = {__0 = 27, __1 = 28}, y = {__0 = 29, __1 = 30}}
42 // gdbr-check:$7 = tuple_in_struct::TuplePaddedAtEnd {x: (27, 28), y: (29, 30)}
43 // gdb-command:print struct_padded_at_end
44 // gdbg-check:$8 = {x = {__0 = 31, __1 = 32}, y = {__0 = 33, __1 = 34}}
45 // gdbr-check:$8 = tuple_in_struct::StructPaddedAtEnd {x: (31, 32), y: (33, 34)}
46 // gdb-command:print both_padded_at_end
47 // gdbg-check:$9 = {x = {__0 = 35, __1 = 36, __2 = 37}, y = {__0 = 38, __1 = 39}}
48 // gdbr-check:$9 = tuple_in_struct::BothPaddedAtEnd {x: (35, 36, 37), y: (38, 39)}
49
50 // gdb-command:print mixed_padding
51 // gdbg-check:$10 = {x = {__0 = {__0 = 40, __1 = 41, __2 = 42}, __1 = {__0 = 43, __1 = 44}}, y = {__0 = 45, __1 = 46, __2 = 47, __3 = 48}}
52 // gdbr-check:$10 = tuple_in_struct::MixedPadding {x: ((40, 41, 42), (43, 44)), y: (45, 46, 47, 48)}
53
54 #![allow(unused_variables)]
55 #![feature(omit_gdb_pretty_printer_section)]
56 #![omit_gdb_pretty_printer_section]
57
58 struct NoPadding1 {
59     x: (i32, i32),
60     y: i32,
61     z: (i32, i32, i32)
62 }
63
64 struct NoPadding2 {
65     x: (i32, i32),
66     y: ((i32, i32), i32)
67 }
68
69 struct TupleInternalPadding {
70     x: (i16, i32),
71     y: (i32, i64)
72 }
73
74 struct StructInternalPadding {
75     x: (i16, i16),
76     y: (i64, i64)
77 }
78
79 struct BothInternallyPadded {
80     x: (i16, i32, i32),
81     y: (i32, i64)
82 }
83
84 struct SingleTuple {
85     x: (i16, i32, i64)
86 }
87
88 struct TuplePaddedAtEnd {
89     x: (i32, i16),
90     y: (i64, i32)
91 }
92
93 struct StructPaddedAtEnd {
94     x: (i64, i64),
95     y: (i16, i16)
96 }
97
98 struct BothPaddedAtEnd {
99     x: (i32, i32, i16),
100     y: (i64, i32)
101 }
102
103 // Data-layout (padding signified by dots, one column = 2 bytes):
104 // [a.bbc...ddddee..ffffg.hhi...]
105 struct MixedPadding {
106     x: ((i16, i32, i16), (i64, i32)),
107     y: (i64, i16, i32, i16)
108 }
109
110
111 fn main() {
112     let no_padding1 = NoPadding1 {
113         x: (0, 1),
114         y: 2,
115         z: (3, 4, 5)
116     };
117
118     let no_padding2 = NoPadding2 {
119         x: (6, 7),
120         y: ((8, 9), 10)
121     };
122
123     let tuple_internal_padding = TupleInternalPadding {
124         x: (11, 12),
125         y: (13, 14)
126     };
127
128     let struct_internal_padding = StructInternalPadding {
129         x: (15, 16),
130         y: (17, 18)
131     };
132
133     let both_internally_padded = BothInternallyPadded {
134         x: (19, 20, 21),
135         y: (22, 23)
136     };
137
138     let single_tuple = SingleTuple {
139         x: (24, 25, 26)
140     };
141
142     let tuple_padded_at_end = TuplePaddedAtEnd {
143         x: (27, 28),
144         y: (29, 30)
145     };
146
147     let struct_padded_at_end = StructPaddedAtEnd {
148         x: (31, 32),
149         y: (33, 34)
150     };
151
152     let both_padded_at_end = BothPaddedAtEnd {
153         x: (35, 36, 37),
154         y: (38, 39)
155     };
156
157     let mixed_padding = MixedPadding {
158         x: ((40, 41, 42), (43, 44)),
159         y: (45, 46, 47, 48)
160     };
161
162     zzz(); // #break
163 }
164
165 fn zzz() {()}