]> git.proxmox.com Git - rustc.git/blob - src/test/debuginfo/destructured-for-loop-variable.rs
Imported Upstream version 1.0.0~beta.3
[rustc.git] / src / test / debuginfo / destructured-for-loop-variable.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 // min-lldb-version: 310
12
13 // compile-flags:-g
14
15 // === GDB TESTS ===================================================================================
16
17 // gdb-command:run
18
19 // DESTRUCTURED STRUCT
20 // gdb-command:print x
21 // gdb-check:$1 = 400
22 // gdb-command:print y
23 // gdb-check:$2 = 401.5
24 // gdb-command:print z
25 // gdb-check:$3 = true
26 // gdb-command:continue
27
28 // DESTRUCTURED TUPLE
29 // gdb-command:print/x _i8
30 // gdb-check:$4 = 0x6f
31 // gdb-command:print/x _u8
32 // gdb-check:$5 = 0x70
33 // gdb-command:print _i16
34 // gdb-check:$6 = -113
35 // gdb-command:print _u16
36 // gdb-check:$7 = 114
37 // gdb-command:print _i32
38 // gdb-check:$8 = -115
39 // gdb-command:print _u32
40 // gdb-check:$9 = 116
41 // gdb-command:print _i64
42 // gdb-check:$10 = -117
43 // gdb-command:print _u64
44 // gdb-check:$11 = 118
45 // gdb-command:print _f32
46 // gdb-check:$12 = 119.5
47 // gdb-command:print _f64
48 // gdb-check:$13 = 120.5
49 // gdb-command:continue
50
51 // MORE COMPLEX CASE
52 // gdb-command:print v1
53 // gdb-check:$14 = 80000
54 // gdb-command:print x1
55 // gdb-check:$15 = 8000
56 // gdb-command:print *y1
57 // gdb-check:$16 = 80001.5
58 // gdb-command:print z1
59 // gdb-check:$17 = false
60 // gdb-command:print *x2
61 // gdb-check:$18 = -30000
62 // gdb-command:print y2
63 // gdb-check:$19 = -300001.5
64 // gdb-command:print *z2
65 // gdb-check:$20 = true
66 // gdb-command:print v2
67 // gdb-check:$21 = 854237.5
68 // gdb-command:continue
69
70 // SIMPLE IDENTIFIER
71 // gdb-command:print i
72 // gdb-check:$22 = 1234
73 // gdb-command:continue
74
75 // gdb-command:print simple_struct_ident
76 // gdb-check:$23 = {x = 3537, y = 35437.5, z = true}
77 // gdb-command:continue
78
79 // gdb-command:print simple_tuple_ident
80 // gdb-check:$24 = {__0 = 34903493, __1 = 232323}
81 // gdb-command:continue
82
83 // === LLDB TESTS ==================================================================================
84
85 // lldb-command:type format add --format hex char
86 // lldb-command:type format add --format hex 'unsigned char'
87
88 // lldb-command:run
89
90 // DESTRUCTURED STRUCT
91 // lldb-command:print x
92 // lldb-check:[...]$0 = 400
93 // lldb-command:print y
94 // lldb-check:[...]$1 = 401.5
95 // lldb-command:print z
96 // lldb-check:[...]$2 = true
97 // lldb-command:continue
98
99 // DESTRUCTURED TUPLE
100 // lldb-command:print _i8
101 // lldb-check:[...]$3 = 0x6f
102 // lldb-command:print _u8
103 // lldb-check:[...]$4 = 0x70
104 // lldb-command:print _i16
105 // lldb-check:[...]$5 = -113
106 // lldb-command:print _u16
107 // lldb-check:[...]$6 = 114
108 // lldb-command:print _i32
109 // lldb-check:[...]$7 = -115
110 // lldb-command:print _u32
111 // lldb-check:[...]$8 = 116
112 // lldb-command:print _i64
113 // lldb-check:[...]$9 = -117
114 // lldb-command:print _u64
115 // lldb-check:[...]$10 = 118
116 // lldb-command:print _f32
117 // lldb-check:[...]$11 = 119.5
118 // lldb-command:print _f64
119 // lldb-check:[...]$12 = 120.5
120 // lldb-command:continue
121
122 // MORE COMPLEX CASE
123 // lldb-command:print v1
124 // lldb-check:[...]$13 = 80000
125 // lldb-command:print x1
126 // lldb-check:[...]$14 = 8000
127 // lldb-command:print *y1
128 // lldb-check:[...]$15 = 80001.5
129 // lldb-command:print z1
130 // lldb-check:[...]$16 = false
131 // lldb-command:print *x2
132 // lldb-check:[...]$17 = -30000
133 // lldb-command:print y2
134 // lldb-check:[...]$18 = -300001.5
135 // lldb-command:print *z2
136 // lldb-check:[...]$19 = true
137 // lldb-command:print v2
138 // lldb-check:[...]$20 = 854237.5
139 // lldb-command:continue
140
141 // SIMPLE IDENTIFIER
142 // lldb-command:print i
143 // lldb-check:[...]$21 = 1234
144 // lldb-command:continue
145
146 // lldb-command:print simple_struct_ident
147 // lldb-check:[...]$22 = Struct { x: 3537, y: 35437.5, z: true }
148 // lldb-command:continue
149
150 // lldb-command:print simple_tuple_ident
151 // lldb-check:[...]$23 = (34903493, 232323)
152 // lldb-command:continue
153
154 #![allow(unused_variables)]
155 #![feature(box_patterns)]
156 #![feature(box_syntax)]
157 #![omit_gdb_pretty_printer_section]
158
159 struct Struct {
160 x: i16,
161 y: f32,
162 z: bool
163 }
164
165 fn main() {
166
167 let s = Struct {
168 x: 400,
169 y: 401.5,
170 z: true
171 };
172
173 for &Struct { x, y, z } in &[s] {
174 zzz(); // #break
175 }
176
177 let tuple: (i8, u8, i16, u16, i32, u32, i64, u64, f32, f64) =
178 (0x6f, 0x70, -113, 114, -115, 116, -117, 118, 119.5, 120.5);
179
180 for &(_i8, _u8, _i16, _u16, _i32, _u32, _i64, _u64, _f32, _f64) in &[tuple] {
181 zzz(); // #break
182 }
183
184 let more_complex: (i32, &Struct, Struct, Box<f64>) =
185 (80000,
186 &Struct {
187 x: 8000,
188 y: 80001.5,
189 z: false
190 },
191 Struct {
192 x: -30000,
193 y: -300001.5,
194 z: true
195 },
196 box 854237.5);
197
198 for &(v1,
199 &Struct { x: x1, y: ref y1, z: z1 },
200 Struct { x: ref x2, y: y2, z: ref z2 },
201 box v2) in [more_complex].iter() {
202 zzz(); // #break
203 }
204
205 for i in 1234..1235 {
206 zzz(); // #break
207 }
208
209 for simple_struct_ident in
210 vec![Struct {
211 x: 3537,
212 y: 35437.5,
213 z: true
214 }].into_iter() {
215 zzz(); // #break
216 }
217
218 for simple_tuple_ident in vec![(34903493u32, 232323i64)] {
219 zzz(); // #break
220 }
221 }
222
223 fn zzz() {()}