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 // gdbg-check:$7 = {__0 = 6, __1 = 7}
37 // gdbr-check:$7 = (6, 7)
38 // gdb-command:continue
40 // gdb-command:print h
42 // gdb-command:print i
43 // gdbg-check:$9 = {a = 9, b = 10}
44 // gdbr-check:$9 = destructured_fn_argument::Struct {a: 9, b: 10}
45 // gdb-command:print j
47 // gdb-command:continue
49 // gdb-command:print k
51 // gdb-command:print l
53 // gdb-command:continue
55 // gdb-command:print m
57 // gdb-command:print n
59 // gdb-command:continue
61 // gdb-command:print o
63 // gdb-command:continue
65 // gdb-command:print p
67 // gdb-command:print q
69 // gdb-command:print r
70 // gdbg-check:$18 = {a = 21, b = 22}
71 // gdbr-check:$18 = destructured_fn_argument::Struct {a: 21, b: 22}
72 // gdb-command:continue
74 // gdb-command:print s
76 // gdb-command:print t
78 // gdb-command:continue
80 // gdb-command:print u
82 // gdb-command:print v
84 // gdb-command:print w
86 // gdb-command:print x
88 // gdb-command:print y
90 // gdb-command:print z
92 // gdb-command:print ae
94 // gdb-command:print oe
96 // gdb-command:print ue
98 // gdb-command:continue
100 // gdb-command:print aa
101 // gdbg-check:$30 = {__0 = 34, __1 = 35}
102 // gdbr-check:$30 = (34, 35)
103 // gdb-command:continue
105 // gdb-command:print bb
106 // gdbg-check:$31 = {__0 = 36, __1 = 37}
107 // gdbr-check:$31 = (36, 37)
108 // gdb-command:continue
110 // gdb-command:print cc
111 // gdb-check:$32 = 38
112 // gdb-command:continue
114 // gdb-command:print dd
115 // gdbg-check:$33 = {__0 = 40, __1 = 41, __2 = 42}
116 // gdbr-check:$33 = (40, 41, 42)
117 // gdb-command:continue
119 // gdb-command:print *ee
120 // gdbg-check:$34 = {__0 = 43, __1 = 44, __2 = 45}
121 // gdbr-check:$34 = (43, 44, 45)
122 // gdb-command:continue
124 // gdb-command:print *ff
125 // gdb-check:$35 = 46
126 // gdb-command:print gg
127 // gdbg-check:$36 = {__0 = 47, __1 = 48}
128 // gdbr-check:$36 = (47, 48)
129 // gdb-command:continue
131 // gdb-command:print *hh
132 // gdb-check:$37 = 50
133 // gdb-command:continue
135 // gdb-command:print ii
136 // gdb-check:$38 = 51
137 // gdb-command:continue
139 // gdb-command:print *jj
140 // gdb-check:$39 = 52
141 // gdb-command:continue
143 // gdb-command:print kk
144 // gdb-check:$40 = 53
145 // gdb-command:print ll
146 // gdb-check:$41 = 54
147 // gdb-command:continue
149 // gdb-command:print mm
150 // gdb-check:$42 = 55
151 // gdb-command:print *nn
152 // gdb-check:$43 = 56
153 // gdb-command:continue
155 // gdb-command:print oo
156 // gdb-check:$44 = 57
157 // gdb-command:print pp
158 // gdb-check:$45 = 58
159 // gdb-command:print qq
160 // gdb-check:$46 = 59
161 // gdb-command:continue
163 // gdb-command:print rr
164 // gdb-check:$47 = 60
165 // gdb-command:print ss
166 // gdb-check:$48 = 61
167 // gdb-command:print tt
168 // gdb-check:$49 = 62
169 // gdb-command:continue
172 // === LLDB TESTS ==================================================================================
176 // lldb-command:print a
177 // lldb-check:[...]$0 = 1
178 // lldb-command:print b
179 // lldb-check:[...]$1 = false
180 // lldb-command:continue
182 // lldb-command:print a
183 // lldb-check:[...]$2 = 2
184 // lldb-command:print b
185 // lldb-check:[...]$3 = 3
186 // lldb-command:print c
187 // lldb-check:[...]$4 = 4
188 // lldb-command:continue
190 // lldb-command:print a
191 // lldb-check:[...]$5 = 5
192 // lldb-command:print b
193 // lldb-check:[...]$6 = (6, 7)
194 // lldb-command:continue
196 // lldb-command:print h
197 // lldb-check:[...]$7 = 8
198 // lldb-command:print i
199 // lldb-check:[...]$8 = Struct { a: 9, b: 10 }
200 // lldb-command:print j
201 // lldb-check:[...]$9 = 11
202 // lldb-command:continue
204 // lldb-command:print k
205 // lldb-check:[...]$10 = 12
206 // lldb-command:print l
207 // lldb-check:[...]$11 = 13
208 // lldb-command:continue
210 // lldb-command:print m
211 // lldb-check:[...]$12 = 14
212 // lldb-command:print n
213 // lldb-check:[...]$13 = 16
214 // lldb-command:continue
216 // lldb-command:print o
217 // lldb-check:[...]$14 = 18
218 // lldb-command:continue
220 // lldb-command:print p
221 // lldb-check:[...]$15 = 19
222 // lldb-command:print q
223 // lldb-check:[...]$16 = 20
224 // lldb-command:print r
225 // lldb-check:[...]$17 = Struct { a: 21, b: 22 }
226 // lldb-command:continue
228 // lldb-command:print s
229 // lldb-check:[...]$18 = 24
230 // lldb-command:print t
231 // lldb-check:[...]$19 = 23
232 // lldb-command:continue
234 // lldb-command:print u
235 // lldb-check:[...]$20 = 25
236 // lldb-command:print v
237 // lldb-check:[...]$21 = 26
238 // lldb-command:print w
239 // lldb-check:[...]$22 = 27
240 // lldb-command:print x
241 // lldb-check:[...]$23 = 28
242 // lldb-command:print y
243 // lldb-check:[...]$24 = 29
244 // lldb-command:print z
245 // lldb-check:[...]$25 = 30
246 // lldb-command:print ae
247 // lldb-check:[...]$26 = 31
248 // lldb-command:print oe
249 // lldb-check:[...]$27 = 32
250 // lldb-command:print ue
251 // lldb-check:[...]$28 = 33
252 // lldb-command:continue
254 // lldb-command:print aa
255 // lldb-check:[...]$29 = (34, 35)
256 // lldb-command:continue
258 // lldb-command:print bb
259 // lldb-check:[...]$30 = (36, 37)
260 // lldb-command:continue
262 // lldb-command:print cc
263 // lldb-check:[...]$31 = 38
264 // lldb-command:continue
266 // lldb-command:print dd
267 // lldb-check:[...]$32 = (40, 41, 42)
268 // lldb-command:continue
270 // lldb-command:print *ee
271 // lldb-check:[...]$33 = (43, 44, 45)
272 // lldb-command:continue
274 // lldb-command:print *ff
275 // lldb-check:[...]$34 = 46
276 // lldb-command:print gg
277 // lldb-check:[...]$35 = (47, 48)
278 // lldb-command:continue
280 // lldb-command:print *hh
281 // lldb-check:[...]$36 = 50
282 // lldb-command:continue
284 // lldb-command:print ii
285 // lldb-check:[...]$37 = 51
286 // lldb-command:continue
288 // lldb-command:print *jj
289 // lldb-check:[...]$38 = 52
290 // lldb-command:continue
292 // lldb-command:print kk
293 // lldb-check:[...]$39 = 53
294 // lldb-command:print ll
295 // lldb-check:[...]$40 = 54
296 // lldb-command:continue
298 // lldb-command:print mm
299 // lldb-check:[...]$41 = 55
300 // lldb-command:print *nn
301 // lldb-check:[...]$42 = 56
302 // lldb-command:continue
304 // lldb-command:print oo
305 // lldb-check:[...]$43 = 57
306 // lldb-command:print pp
307 // lldb-check:[...]$44 = 58
308 // lldb-command:print qq
309 // lldb-check:[...]$45 = 59
310 // lldb-command:continue
312 // lldb-command:print rr
313 // lldb-check:[...]$46 = 60
314 // lldb-command:print ss
315 // lldb-check:[...]$47 = 61
316 // lldb-command:print tt
317 // lldb-check:[...]$48 = 62
318 // lldb-command:continue
320 #![allow(unused_variables)]
321 #![feature(box_patterns)]
322 #![feature(box_syntax)]
323 #![feature(omit_gdb_pretty_printer_section)]
324 #![omit_gdb_pretty_printer_section]
326 use self::Univariant::Unit;
337 struct TupleStruct (f64, isize);
340 fn simple_tuple((a, b): (isize, bool)) {
344 fn nested_tuple((a, (b, c)): (isize, (u16, u16))) {
348 fn destructure_only_first_level((a, b): (isize, (u32, u32))) {
352 fn struct_as_tuple_element((h, i, j): (i16, Struct, i16)) {
356 fn struct_pattern(Struct { a: k, b: l }: Struct) {
360 fn ignored_tuple_element((m, _, n): (isize, u16, i32)) {
364 fn ignored_struct_field(Struct { b: o, .. }: Struct) {
368 fn one_struct_destructured_one_not((Struct { a: p, b: q }, r): (Struct, Struct)) {
372 fn different_order_of_struct_fields(Struct { b: s, a: t }: Struct ) {
376 fn complex_nesting(((u, v ), ((w, (x, Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue ):
377 ((i16, i32), ((i64, (i32, Struct, )), Struct ), u16))
382 fn managed_box(&aa: &(isize, isize)) {
386 fn borrowed_pointer(&bb: &(isize, isize)) {
390 fn contained_borrowed_pointer((&cc, _): (&isize, isize)) {
394 fn unique_pointer(box dd: Box<(isize, isize, isize)>) {
398 fn ref_binding(ref ee: (isize, isize, isize)) {
402 fn ref_binding_in_tuple((ref ff, gg): (isize, (isize, isize))) {
406 fn ref_binding_in_struct(Struct { b: ref hh, .. }: Struct) {
410 fn univariant_enum(Unit(ii): Univariant) {
414 fn univariant_enum_with_ref_binding(Unit(ref jj): Univariant) {
418 fn tuple_struct(TupleStruct(kk, ll): TupleStruct) {
422 fn tuple_struct_with_ref_binding(TupleStruct(mm, ref nn): TupleStruct) {
426 fn multiple_arguments((oo, pp): (isize, isize), qq : isize) {
431 simple_tuple((1, false));
432 nested_tuple((2, (3, 4)));
433 destructure_only_first_level((5, (6, 7)));
434 struct_as_tuple_element((8, Struct { a: 9, b: 10 }, 11));
435 struct_pattern(Struct { a: 12, b: 13 });
436 ignored_tuple_element((14, 15, 16));
437 ignored_struct_field(Struct { a: 17, b: 18 });
438 one_struct_destructured_one_not((Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 }));
439 different_order_of_struct_fields(Struct { a: 23, b: 24 });
440 complex_nesting(((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33));
441 managed_box(&(34, 35));
442 borrowed_pointer(&(36, 37));
443 contained_borrowed_pointer((&38, 39));
444 unique_pointer(box (40, 41, 42));
445 ref_binding((43, 44, 45));
446 ref_binding_in_tuple((46, (47, 48)));
447 ref_binding_in_struct(Struct { a: 49, b: 50 });
448 univariant_enum(Unit(51));
449 univariant_enum_with_ref_binding(Unit(52));
450 tuple_struct(TupleStruct(53.0, 54));
451 tuple_struct_with_ref_binding(TupleStruct(55.0, 56));
452 multiple_arguments((57, 58), 59);
454 fn nested_function(rr: isize, (ss, tt): (isize, isize)) {
458 nested_function(60, (61, 62));