]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/closure-in-generic-function.rs
Auto merge of #106646 - Amanieu:ilp32-object, r=Mark-Simulacrum
[rust.git] / tests / debuginfo / closure-in-generic-function.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 x
10 // gdb-check:$1 = 0.5
11 // gdb-command:print y
12 // gdb-check:$2 = 10
13 // gdb-command:continue
14
15 // gdb-command:print *x
16 // gdb-check:$3 = 29
17 // gdb-command:print *y
18 // gdb-check:$4 = 110
19 // gdb-command:continue
20
21
22 // === LLDB TESTS ==================================================================================
23
24 // lldb-command:run
25
26 // lldb-command:print x
27 // lldbg-check:[...]$0 = 0.5
28 // lldbr-check:(f64) x = 0.5
29 // lldb-command:print y
30 // lldbg-check:[...]$1 = 10
31 // lldbr-check:(i32) y = 10
32 // lldb-command:continue
33
34 // lldb-command:print *x
35 // lldbg-check:[...]$2 = 29
36 // lldbr-check:(i32) *x = 29
37 // lldb-command:print *y
38 // lldbg-check:[...]$3 = 110
39 // lldbr-check:(i32) *y = 110
40 // lldb-command:continue
41
42 #![feature(omit_gdb_pretty_printer_section)]
43 #![omit_gdb_pretty_printer_section]
44
45 fn some_generic_fun<T1, T2>(a: T1, b: T2) -> (T2, T1) {
46
47     let closure = |x, y| {
48         zzz(); // #break
49         (y, x)
50     };
51
52     closure(a, b)
53 }
54
55 fn main() {
56     some_generic_fun(0.5f64, 10);
57     some_generic_fun(&29, Box::new(110));
58 }
59
60 fn zzz() { () }