]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/destructured-fn-argument.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[rust.git] / tests / debuginfo / destructured-fn-argument.rs
1 // min-lldb-version: 310
2
3 // compile-flags:-g
4
5 // === GDB TESTS ===================================================================================
6
7 // gdb-command:run
8
9 // gdb-command:print a
10 // gdb-check:$1 = 1
11 // gdb-command:print b
12 // gdb-check:$2 = false
13 // gdb-command:continue
14
15 // gdb-command:print a
16 // gdb-check:$3 = 2
17 // gdb-command:print b
18 // gdb-check:$4 = 3
19 // gdb-command:print c
20 // gdb-check:$5 = 4
21 // gdb-command:continue
22
23 // gdb-command:print a
24 // gdb-check:$6 = 5
25 // gdb-command:print b
26 // gdbg-check:$7 = {__0 = 6, __1 = 7}
27 // gdbr-check:$7 = (6, 7)
28 // gdb-command:continue
29
30 // gdb-command:print h
31 // gdb-check:$8 = 8
32 // gdb-command:print i
33 // gdbg-check:$9 = {a = 9, b = 10}
34 // gdbr-check:$9 = destructured_fn_argument::Struct {a: 9, b: 10}
35 // gdb-command:print j
36 // gdb-check:$10 = 11
37 // gdb-command:continue
38
39 // gdb-command:print k
40 // gdb-check:$11 = 12
41 // gdb-command:print l
42 // gdb-check:$12 = 13
43 // gdb-command:continue
44
45 // gdb-command:print m
46 // gdb-check:$13 = 14
47 // gdb-command:print n
48 // gdb-check:$14 = 16
49 // gdb-command:continue
50
51 // gdb-command:print o
52 // gdb-check:$15 = 18
53 // gdb-command:continue
54
55 // gdb-command:print p
56 // gdb-check:$16 = 19
57 // gdb-command:print q
58 // gdb-check:$17 = 20
59 // gdb-command:print r
60 // gdbg-check:$18 = {a = 21, b = 22}
61 // gdbr-check:$18 = destructured_fn_argument::Struct {a: 21, b: 22}
62 // gdb-command:continue
63
64 // gdb-command:print s
65 // gdb-check:$19 = 24
66 // gdb-command:print t
67 // gdb-check:$20 = 23
68 // gdb-command:continue
69
70 // gdb-command:print u
71 // gdb-check:$21 = 25
72 // gdb-command:print v
73 // gdb-check:$22 = 26
74 // gdb-command:print w
75 // gdb-check:$23 = 27
76 // gdb-command:print x
77 // gdb-check:$24 = 28
78 // gdb-command:print y
79 // gdb-check:$25 = 29
80 // gdb-command:print z
81 // gdb-check:$26 = 30
82 // gdb-command:print ae
83 // gdb-check:$27 = 31
84 // gdb-command:print oe
85 // gdb-check:$28 = 32
86 // gdb-command:print ue
87 // gdb-check:$29 = 33
88 // gdb-command:continue
89
90 // gdb-command:print aa
91 // gdbg-check:$30 = {__0 = 34, __1 = 35}
92 // gdbr-check:$30 = (34, 35)
93 // gdb-command:continue
94
95 // gdb-command:print bb
96 // gdbg-check:$31 = {__0 = 36, __1 = 37}
97 // gdbr-check:$31 = (36, 37)
98 // gdb-command:continue
99
100 // gdb-command:print cc
101 // gdb-check:$32 = 38
102 // gdb-command:continue
103
104 // gdb-command:print dd
105 // gdbg-check:$33 = {__0 = 40, __1 = 41, __2 = 42}
106 // gdbr-check:$33 = (40, 41, 42)
107 // gdb-command:continue
108
109 // gdb-command:print *ee
110 // gdbg-check:$34 = {__0 = 43, __1 = 44, __2 = 45}
111 // gdbr-check:$34 = (43, 44, 45)
112 // gdb-command:continue
113
114 // gdb-command:print *ff
115 // gdb-check:$35 = 46
116 // gdb-command:print gg
117 // gdbg-check:$36 = {__0 = 47, __1 = 48}
118 // gdbr-check:$36 = (47, 48)
119 // gdb-command:continue
120
121 // gdb-command:print *hh
122 // gdb-check:$37 = 50
123 // gdb-command:continue
124
125 // gdb-command:print ii
126 // gdb-check:$38 = 51
127 // gdb-command:continue
128
129 // gdb-command:print *jj
130 // gdb-check:$39 = 52
131 // gdb-command:continue
132
133 // gdb-command:print kk
134 // gdb-check:$40 = 53
135 // gdb-command:print ll
136 // gdb-check:$41 = 54
137 // gdb-command:continue
138
139 // gdb-command:print mm
140 // gdb-check:$42 = 55
141 // gdb-command:print *nn
142 // gdb-check:$43 = 56
143 // gdb-command:continue
144
145 // gdb-command:print oo
146 // gdb-check:$44 = 57
147 // gdb-command:print pp
148 // gdb-check:$45 = 58
149 // gdb-command:print qq
150 // gdb-check:$46 = 59
151 // gdb-command:continue
152
153 // gdb-command:print rr
154 // gdb-check:$47 = 60
155 // gdb-command:print ss
156 // gdb-check:$48 = 61
157 // gdb-command:print tt
158 // gdb-check:$49 = 62
159 // gdb-command:continue
160
161
162 // === LLDB TESTS ==================================================================================
163
164 // lldb-command:run
165
166 // lldb-command:print a
167 // lldbg-check:[...]$0 = 1
168 // lldbr-check:(isize) a = 1
169 // lldb-command:print b
170 // lldbg-check:[...]$1 = false
171 // lldbr-check:(bool) b = false
172 // lldb-command:continue
173
174 // lldb-command:print a
175 // lldbg-check:[...]$2 = 2
176 // lldbr-check:(isize) a = 2
177 // lldb-command:print b
178 // lldbg-check:[...]$3 = 3
179 // lldbr-check:(u16) b = 3
180 // lldb-command:print c
181 // lldbg-check:[...]$4 = 4
182 // lldbr-check:(u16) c = 4
183 // lldb-command:continue
184
185 // lldb-command:print a
186 // lldbg-check:[...]$5 = 5
187 // lldbr-check:(isize) a = 5
188 // lldb-command:print b
189 // lldbg-check:[...]$6 = { 0 = 6 1 = 7 }
190 // lldbr-check:((u32, u32)) b = { 0 = 6 1 = 7 }
191 // lldb-command:continue
192
193 // lldb-command:print h
194 // lldbg-check:[...]$7 = 8
195 // lldbr-check:(i16) h = 8
196 // lldb-command:print i
197 // lldbg-check:[...]$8 = { a = 9 b = 10 }
198 // lldbr-check:(destructured_fn_argument::Struct) i = { a = 9 b = 10 }
199 // lldb-command:print j
200 // lldbg-check:[...]$9 = 11
201 // lldbr-check:(i16) j = 11
202 // lldb-command:continue
203
204 // lldb-command:print k
205 // lldbg-check:[...]$10 = 12
206 // lldbr-check:(i64) k = 12
207 // lldb-command:print l
208 // lldbg-check:[...]$11 = 13
209 // lldbr-check:(i32) l = 13
210 // lldb-command:continue
211
212 // lldb-command:print m
213 // lldbg-check:[...]$12 = 14
214 // lldbr-check:(isize) m = 14
215 // lldb-command:print n
216 // lldbg-check:[...]$13 = 16
217 // lldbr-check:(i32) n = 16
218 // lldb-command:continue
219
220 // lldb-command:print o
221 // lldbg-check:[...]$14 = 18
222 // lldbr-check:(i32) o = 18
223 // lldb-command:continue
224
225 // lldb-command:print p
226 // lldbg-check:[...]$15 = 19
227 // lldbr-check:(i64) p = 19
228 // lldb-command:print q
229 // lldbg-check:[...]$16 = 20
230 // lldbr-check:(i32) q = 20
231 // lldb-command:print r
232 // lldbg-check:[...]$17 = { a = 21 b = 22 }
233 // lldbr-check:(destructured_fn_argument::Struct) r = { a = 21, b = 22 }
234 // lldb-command:continue
235
236 // lldb-command:print s
237 // lldbg-check:[...]$18 = 24
238 // lldbr-check:(i32) s = 24
239 // lldb-command:print t
240 // lldbg-check:[...]$19 = 23
241 // lldbr-check:(i64) t = 23
242 // lldb-command:continue
243
244 // lldb-command:print u
245 // lldbg-check:[...]$20 = 25
246 // lldbr-check:(i16) u = 25
247 // lldb-command:print v
248 // lldbg-check:[...]$21 = 26
249 // lldbr-check:(i32) v = 26
250 // lldb-command:print w
251 // lldbg-check:[...]$22 = 27
252 // lldbr-check:(i64) w = 27
253 // lldb-command:print x
254 // lldbg-check:[...]$23 = 28
255 // lldbr-check:(i32) x = 28
256 // lldb-command:print y
257 // lldbg-check:[...]$24 = 29
258 // lldbr-check:(i64) y = 29
259 // lldb-command:print z
260 // lldbg-check:[...]$25 = 30
261 // lldbr-check:(i32) z = 30
262 // lldb-command:print ae
263 // lldbg-check:[...]$26 = 31
264 // lldbr-check:(i64) ae = 31
265 // lldb-command:print oe
266 // lldbg-check:[...]$27 = 32
267 // lldbr-check:(i32) oe = 32
268 // lldb-command:print ue
269 // lldbg-check:[...]$28 = 33
270 // lldbr-check:(u16) ue = 33
271 // lldb-command:continue
272
273 // lldb-command:print aa
274 // lldbg-check:[...]$29 = { 0 = 34 1 = 35 }
275 // lldbr-check:((isize, isize)) aa = { 0 = 34 1 = 35 }
276 // lldb-command:continue
277
278 // lldb-command:print bb
279 // lldbg-check:[...]$30 = { 0 = 36 1 = 37 }
280 // lldbr-check:((isize, isize)) bb = { 0 = 36 1 = 37 }
281 // lldb-command:continue
282
283 // lldb-command:print cc
284 // lldbg-check:[...]$31 = 38
285 // lldbr-check:(isize) cc = 38
286 // lldb-command:continue
287
288 // lldb-command:print dd
289 // lldbg-check:[...]$32 = { 0 = 40 1 = 41 2 = 42 }
290 // lldbr-check:((isize, isize, isize)) dd = { 0 = 40 1 = 41 2 = 42 }
291 // lldb-command:continue
292
293 // lldb-command:print *ee
294 // lldbg-check:[...]$33 = { 0 = 43 1 = 44 2 = 45 }
295 // lldbr-check:((isize, isize, isize)) *ee = { 0 = 43 1 = 44 2 = 45 }
296 // lldb-command:continue
297
298 // lldb-command:print *ff
299 // lldbg-check:[...]$34 = 46
300 // lldbr-check:(isize) *ff = 46
301 // lldb-command:print gg
302 // lldbg-check:[...]$35 = { 0 = 47 1 = 48 }
303 // lldbr-check:((isize, isize)) gg = { 0 = 47 1 = 48 }
304 // lldb-command:continue
305
306 // lldb-command:print *hh
307 // lldbg-check:[...]$36 = 50
308 // lldbr-check:(i32) *hh = 50
309 // lldb-command:continue
310
311 // lldb-command:print ii
312 // lldbg-check:[...]$37 = 51
313 // lldbr-check:(i32) ii = 51
314 // lldb-command:continue
315
316 // lldb-command:print *jj
317 // lldbg-check:[...]$38 = 52
318 // lldbr-check:(i32) *jj = 52
319 // lldb-command:continue
320
321 // lldb-command:print kk
322 // lldbg-check:[...]$39 = 53
323 // lldbr-check:(f64) kk = 53
324 // lldb-command:print ll
325 // lldbg-check:[...]$40 = 54
326 // lldbr-check:(isize) ll = 54
327 // lldb-command:continue
328
329 // lldb-command:print mm
330 // lldbg-check:[...]$41 = 55
331 // lldbr-check:(f64) mm = 55
332 // lldb-command:print *nn
333 // lldbg-check:[...]$42 = 56
334 // lldbr-check:(isize) *nn = 56
335 // lldb-command:continue
336
337 // lldb-command:print oo
338 // lldbg-check:[...]$43 = 57
339 // lldbr-check:(isize) oo = 57
340 // lldb-command:print pp
341 // lldbg-check:[...]$44 = 58
342 // lldbr-check:(isize) pp = 58
343 // lldb-command:print qq
344 // lldbg-check:[...]$45 = 59
345 // lldbr-check:(isize) qq = 59
346 // lldb-command:continue
347
348 // lldb-command:print rr
349 // lldbg-check:[...]$46 = 60
350 // lldbr-check:(isize) rr = 60
351 // lldb-command:print ss
352 // lldbg-check:[...]$47 = 61
353 // lldbr-check:(isize) ss = 61
354 // lldb-command:print tt
355 // lldbg-check:[...]$48 = 62
356 // lldbr-check:(isize) tt = 62
357 // lldb-command:continue
358
359 #![allow(unused_variables)]
360 #![feature(box_patterns)]
361 #![feature(omit_gdb_pretty_printer_section)]
362 #![omit_gdb_pretty_printer_section]
363
364 use self::Univariant::Unit;
365
366 struct Struct {
367     a: i64,
368     b: i32
369 }
370
371 enum Univariant {
372     Unit(i32)
373 }
374
375 struct TupleStruct (f64, isize);
376
377
378 fn simple_tuple((a, b): (isize, bool)) {
379     zzz(); // #break
380 }
381
382 fn nested_tuple((a, (b, c)): (isize, (u16, u16))) {
383     zzz(); // #break
384 }
385
386 fn destructure_only_first_level((a, b): (isize, (u32, u32))) {
387     zzz(); // #break
388 }
389
390 fn struct_as_tuple_element((h, i, j): (i16, Struct, i16)) {
391     zzz(); // #break
392 }
393
394 fn struct_pattern(Struct { a: k, b: l }: Struct) {
395     zzz(); // #break
396 }
397
398 fn ignored_tuple_element((m, _, n): (isize, u16, i32)) {
399     zzz(); // #break
400 }
401
402 fn ignored_struct_field(Struct { b: o, .. }: Struct) {
403     zzz(); // #break
404 }
405
406 fn one_struct_destructured_one_not((Struct { a: p, b: q }, r): (Struct, Struct)) {
407     zzz(); // #break
408 }
409
410 fn different_order_of_struct_fields(Struct { b: s, a: t }: Struct ) {
411     zzz(); // #break
412 }
413
414 fn complex_nesting(((u,   v  ), ((w,   (x,   Struct { a: y, b: z})), Struct { a: ae, b: oe }), ue ):
415                    ((i16, i32), ((i64, (i32, Struct,             )), Struct                 ), u16))
416 {
417     zzz(); // #break
418 }
419
420 fn managed_box(&aa: &(isize, isize)) {
421     zzz(); // #break
422 }
423
424 fn borrowed_pointer(&bb: &(isize, isize)) {
425     zzz(); // #break
426 }
427
428 fn contained_borrowed_pointer((&cc, _): (&isize, isize)) {
429     zzz(); // #break
430 }
431
432 fn unique_pointer(box dd: Box<(isize, isize, isize)>) {
433     zzz(); // #break
434 }
435
436 fn ref_binding(ref ee: (isize, isize, isize)) {
437     zzz(); // #break
438 }
439
440 fn ref_binding_in_tuple((ref ff, gg): (isize, (isize, isize))) {
441     zzz(); // #break
442 }
443
444 fn ref_binding_in_struct(Struct { b: ref hh, .. }: Struct) {
445     zzz(); // #break
446 }
447
448 fn univariant_enum(Unit(ii): Univariant) {
449     zzz(); // #break
450 }
451
452 fn univariant_enum_with_ref_binding(Unit(ref jj): Univariant) {
453     zzz(); // #break
454 }
455
456 fn tuple_struct(TupleStruct(kk, ll): TupleStruct) {
457     zzz(); // #break
458 }
459
460 fn tuple_struct_with_ref_binding(TupleStruct(mm, ref nn): TupleStruct) {
461     zzz(); // #break
462 }
463
464 fn multiple_arguments((oo, pp): (isize, isize), qq : isize) {
465     zzz(); // #break
466 }
467
468 fn main() {
469     simple_tuple((1, false));
470     nested_tuple((2, (3, 4)));
471     destructure_only_first_level((5, (6, 7)));
472     struct_as_tuple_element((8, Struct { a: 9, b: 10 }, 11));
473     struct_pattern(Struct { a: 12, b: 13 });
474     ignored_tuple_element((14, 15, 16));
475     ignored_struct_field(Struct { a: 17, b: 18 });
476     one_struct_destructured_one_not((Struct { a: 19, b: 20 }, Struct { a: 21, b: 22 }));
477     different_order_of_struct_fields(Struct { a: 23, b: 24 });
478     complex_nesting(((25, 26), ((27, (28, Struct { a: 29, b: 30})), Struct { a: 31, b: 32 }), 33));
479     managed_box(&(34, 35));
480     borrowed_pointer(&(36, 37));
481     contained_borrowed_pointer((&38, 39));
482     unique_pointer(Box::new((40, 41, 42)));
483     ref_binding((43, 44, 45));
484     ref_binding_in_tuple((46, (47, 48)));
485     ref_binding_in_struct(Struct { a: 49, b: 50 });
486     univariant_enum(Unit(51));
487     univariant_enum_with_ref_binding(Unit(52));
488     tuple_struct(TupleStruct(53.0, 54));
489     tuple_struct_with_ref_binding(TupleStruct(55.0, 56));
490     multiple_arguments((57, 58), 59);
491
492     fn nested_function(rr: isize, (ss, tt): (isize, isize)) {
493         zzz(); // #break
494     }
495
496     nested_function(60, (61, 62));
497 }
498
499 fn zzz() { () }