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.
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.
11 // min-lldb-version: 310
15 // === GDB TESTS ===================================================================================
19 // gdb-command:print a
21 // gdb-command:print b
22 // gdb-check:$2 = false
23 // gdb-command:continue
25 // gdb-command:print a
27 // gdb-command:print b
29 // gdb-command:print c
31 // gdb-command:continue
33 // gdb-command:print a
35 // gdb-command:print b
36 // gdb-check:$7 = {6, 7}
37 // gdb-command:continue
39 // gdb-command:print h
41 // gdb-command:print i
42 // gdb-check:$9 = {a = 9, b = 10}
43 // gdb-command:print j
45 // gdb-command:continue
47 // gdb-command:print k
49 // gdb-command:print l
51 // gdb-command:continue
53 // gdb-command:print m
55 // gdb-command:print n
57 // gdb-command:continue
59 // gdb-command:print o
61 // gdb-command:continue
63 // gdb-command:print p
65 // gdb-command:print q
67 // gdb-command:print r
68 // gdb-check:$18 = {a = 21, b = 22}
69 // gdb-command:continue
71 // gdb-command:print s
73 // gdb-command:print t
75 // gdb-command:continue
77 // gdb-command:print u
79 // gdb-command:print v
81 // gdb-command:print w
83 // gdb-command:print x
85 // gdb-command:print y
87 // gdb-command:print z
89 // gdb-command:print ae
91 // gdb-command:print oe
93 // gdb-command:print ue
95 // gdb-command:continue
97 // gdb-command:print aa
98 // gdb-check:$30 = {34, 35}
99 // gdb-command:continue
101 // gdb-command:print bb
102 // gdb-check:$31 = {36, 37}
103 // gdb-command:continue
105 // gdb-command:print cc
106 // gdb-check:$32 = 38
107 // gdb-command:continue
109 // gdb-command:print dd
110 // gdb-check:$33 = {40, 41, 42}
111 // gdb-command:continue
113 // gdb-command:print *ee
114 // gdb-check:$34 = {43, 44, 45}
115 // gdb-command:continue
117 // gdb-command:print *ff
118 // gdb-check:$35 = 46
119 // gdb-command:print gg
120 // gdb-check:$36 = {47, 48}
121 // gdb-command:continue
123 // gdb-command:print *hh
124 // gdb-check:$37 = 50
125 // gdb-command:continue
127 // gdb-command:print ii
128 // gdb-check:$38 = 51
129 // gdb-command:continue
131 // gdb-command:print *jj
132 // gdb-check:$39 = 52
133 // gdb-command:continue
135 // gdb-command:print kk
136 // gdb-check:$40 = 53
137 // gdb-command:print ll
138 // gdb-check:$41 = 54
139 // gdb-command:continue
141 // gdb-command:print mm
142 // gdb-check:$42 = 55
143 // gdb-command:print *nn
144 // gdb-check:$43 = 56
145 // gdb-command:continue
147 // gdb-command:print oo
148 // gdb-check:$44 = 57
149 // gdb-command:print pp
150 // gdb-check:$45 = 58
151 // gdb-command:print qq
152 // gdb-check:$46 = 59
153 // gdb-command:continue
155 // gdb-command:print rr
156 // gdb-check:$47 = 60
157 // gdb-command:print ss
158 // gdb-check:$48 = 61
159 // gdb-command:print tt
160 // gdb-check:$49 = 62
161 // gdb-command:continue
164 // === LLDB TESTS ==================================================================================
168 // lldb-command:print a
169 // lldb-check:[...]$0 = 1
170 // lldb-command:print b
171 // lldb-check:[...]$1 = false
172 // lldb-command:continue
174 // lldb-command:print a
175 // lldb-check:[...]$2 = 2
176 // lldb-command:print b
177 // lldb-check:[...]$3 = 3
178 // lldb-command:print c
179 // lldb-check:[...]$4 = 4
180 // lldb-command:continue
182 // lldb-command:print a
183 // lldb-check:[...]$5 = 5
184 // lldb-command:print b
185 // lldb-check:[...]$6 = (6, 7)
186 // lldb-command:continue
188 // lldb-command:print h
189 // lldb-check:[...]$7 = 8
190 // lldb-command:print i
191 // lldb-check:[...]$8 = Struct { a: 9, b: 10 }
192 // lldb-command:print j
193 // lldb-check:[...]$9 = 11
194 // lldb-command:continue
196 // lldb-command:print k
197 // lldb-check:[...]$10 = 12
198 // lldb-command:print l
199 // lldb-check:[...]$11 = 13
200 // lldb-command:continue
202 // lldb-command:print m
203 // lldb-check:[...]$12 = 14
204 // lldb-command:print n
205 // lldb-check:[...]$13 = 16
206 // lldb-command:continue
208 // lldb-command:print o
209 // lldb-check:[...]$14 = 18
210 // lldb-command:continue
212 // lldb-command:print p
213 // lldb-check:[...]$15 = 19
214 // lldb-command:print q
215 // lldb-check:[...]$16 = 20
216 // lldb-command:print r
217 // lldb-check:[...]$17 = Struct { a: 21, b: 22 }
218 // lldb-command:continue
220 // lldb-command:print s
221 // lldb-check:[...]$18 = 24
222 // lldb-command:print t
223 // lldb-check:[...]$19 = 23
224 // lldb-command:continue
226 // lldb-command:print u
227 // lldb-check:[...]$20 = 25
228 // lldb-command:print v
229 // lldb-check:[...]$21 = 26
230 // lldb-command:print w
231 // lldb-check:[...]$22 = 27
232 // lldb-command:print x
233 // lldb-check:[...]$23 = 28
234 // lldb-command:print y
235 // lldb-check:[...]$24 = 29
236 // lldb-command:print z
237 // lldb-check:[...]$25 = 30
238 // lldb-command:print ae
239 // lldb-check:[...]$26 = 31
240 // lldb-command:print oe
241 // lldb-check:[...]$27 = 32
242 // lldb-command:print ue
243 // lldb-check:[...]$28 = 33
244 // lldb-command:continue
246 // lldb-command:print aa
247 // lldb-check:[...]$29 = (34, 35)
248 // lldb-command:continue
250 // lldb-command:print bb
251 // lldb-check:[...]$30 = (36, 37)
252 // lldb-command:continue
254 // lldb-command:print cc
255 // lldb-check:[...]$31 = 38
256 // lldb-command:continue
258 // lldb-command:print dd
259 // lldb-check:[...]$32 = (40, 41, 42)
260 // lldb-command:continue
262 // lldb-command:print *ee
263 // lldb-check:[...]$33 = (43, 44, 45)
264 // lldb-command:continue
266 // lldb-command:print *ff
267 // lldb-check:[...]$34 = 46
268 // lldb-command:print gg
269 // lldb-check:[...]$35 = (47, 48)
270 // lldb-command:continue
272 // lldb-command:print *hh
273 // lldb-check:[...]$36 = 50
274 // lldb-command:continue
276 // lldb-command:print ii
277 // lldb-check:[...]$37 = 51
278 // lldb-command:continue
280 // lldb-command:print *jj
281 // lldb-check:[...]$38 = 52
282 // lldb-command:continue
284 // lldb-command:print kk
285 // lldb-check:[...]$39 = 53
286 // lldb-command:print ll
287 // lldb-check:[...]$40 = 54
288 // lldb-command:continue
290 // lldb-command:print mm
291 // lldb-check:[...]$41 = 55
292 // lldb-command:print *nn
293 // lldb-check:[...]$42 = 56
294 // lldb-command:continue
296 // lldb-command:print oo
297 // lldb-check:[...]$43 = 57
298 // lldb-command:print pp
299 // lldb-check:[...]$44 = 58
300 // lldb-command:print qq
301 // lldb-check:[...]$45 = 59
302 // lldb-command:continue
304 // lldb-command:print rr
305 // lldb-check:[...]$46 = 60
306 // lldb-command:print ss
307 // lldb-check:[...]$47 = 61
308 // lldb-command:print tt
309 // lldb-check:[...]$48 = 62
310 // lldb-command:continue
312 #![allow(unused_variables)]
313 #![feature(box_patterns)]
314 #![feature(box_syntax)]
315 #![omit_gdb_pretty_printer_section]
317 use self::Univariant::Unit;
328 struct TupleStruct (f64, isize);
331 fn simple_tuple((a, b): (isize, bool)) {
335 fn nested_tuple((a, (b, c)): (isize, (u16, u16))) {
339 fn destructure_only_first_level((a, b): (isize, (u32, u32))) {
343 fn struct_as_tuple_element((h, i, j): (i16, Struct, i16)) {
347 fn struct_pattern(Struct { a: k, b: l }: Struct) {
351 fn ignored_tuple_element((m, _, n): (isize, u16, i32)) {
355 fn ignored_struct_field(Struct { b: o, .. }: Struct) {
359 fn one_struct_destructured_one_not((Struct { a: p, b: q }, r): (Struct, Struct)) {
363 fn different_order_of_struct_fields(Struct { b: s, a: t }: Struct ) {
367 fn complex_nesting(((u, v ), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue ):
368 ((i16, i32), ((i64, (i32, Struct, )), Struct ), u16))
373 fn managed_box(&aa: &(isize, isize)) {
377 fn borrowed_pointer(&bb: &(isize, isize)) {
381 fn contained_borrowed_pointer((&cc, _): (&isize, isize)) {
385 fn unique_pointer(box dd: Box<(isize, isize, isize)>) {
389 fn ref_binding(ref ee: (isize, isize, isize)) {
393 fn ref_binding_in_tuple((ref ff, gg): (isize, (isize, isize))) {
397 fn ref_binding_in_struct(Struct { b: ref hh, .. }: Struct) {
401 fn univariant_enum(Unit(ii): Univariant) {
405 fn univariant_enum_with_ref_binding(Unit(ref jj): Univariant) {
409 fn tuple_struct(TupleStruct(kk, ll): TupleStruct) {
413 fn tuple_struct_with_ref_binding(TupleStruct(mm, ref nn): TupleStruct) {
417 fn multiple_arguments((oo, pp): (isize, isize), qq : isize) {
422 simple_tuple((1, false));
423 nested_tuple((2, (3, 4)));
424 destructure_only_first_level((5, (6, 7)));
425 struct_as_tuple_element((8, Struct { a: 9, b: 10 }, 11));
426 struct_pattern(Struct { a: 12, b: 13 });
427 ignored_tuple_element((14, 15, 16));
428 ignored_struct_field(Struct { a: 17, b: 18 });
429 one_struct_destructured_one_not((Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 }));
430 different_order_of_struct_fields(Struct { a: 23, b: 24 });
431 complex_nesting(((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33));
432 managed_box(&(34, 35));
433 borrowed_pointer(&(36, 37));
434 contained_borrowed_pointer((&38, 39));
435 unique_pointer(box() (40, 41, 42));
436 ref_binding((43, 44, 45));
437 ref_binding_in_tuple((46, (47, 48)));
438 ref_binding_in_struct(Struct { a: 49, b: 50 });
439 univariant_enum(Unit(51));
440 univariant_enum_with_ref_binding(Unit(52));
441 tuple_struct(TupleStruct(53.0, 54));
442 tuple_struct_with_ref_binding(TupleStruct(55.0, 56));
443 multiple_arguments((57, 58), 59);
445 fn nested_function(rr: isize, (ss, tt): (isize, isize)) {
449 nested_function(60, (61, 62));