]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/lexical-scope-in-if-let.rs
Merge commit '7d53619064ab7045c383644cb445052d2a3d46db' into sync_cg_clif-2023-02-09
[rust.git] / tests / debuginfo / lexical-scope-in-if-let.rs
1 // compile-flags:-g
2
3 // === GDB TESTS ==================================================================================
4
5 // gdb-command:run
6 // gdb-command:info locals
7 // gdb-check:a = 123
8
9 // gdb-command:continue
10 // gdb-command:info locals
11 // gdb-check:x = 42
12 // gdb-check:a = 123
13
14 // gdb-command:continue
15 // gdb-command:info locals
16 // gdb-check:y = true
17 // gdb-check:b = 456
18 // gdb-check:x = 42
19 // gdb-check:a = 123
20
21 // gdb-command:continue
22 // gdb-command:info locals
23 // gdb-check:z = 10
24 // gdb-check:c = 789
25 // gdb-check:y = true
26 // gdb-check:b = 456
27 // gdb-check:x = 42
28 // gdb-check:a = 123
29
30 // === LLDB TESTS =================================================================================
31
32 // lldb-command:run
33 // lldb-command:frame variable
34 // lldb-check:(int) a = 123
35
36 // lldb-command:continue
37 // lldb-command:frame variable
38 // lldb-check:(int) a = 123 (int) x = 42
39
40 // lldb-command:continue
41 // lldb-command:frame variable
42 // lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true
43
44 // lldb-command:continue
45 // lldb-command:frame variable
46 // lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true (int) c = 789 (int) z = 10
47
48 // === CDB TESTS ==================================================================================
49
50 // cdb-command: g
51 // cdb-command: dv
52 // cdb-check:[...]a = 0n123
53
54 // cdb-command: g
55 // cdb-command: dv
56 // cdb-check:[...]a = 0n123
57 // cdb-check:[...]x = 0n42
58
59 // cdb-command: g
60 // cdb-command: dv
61 // cdb-check:[...]a = 0n123
62 // cdb-check:[...]x = 0n42
63 // cdb-check:[...]b = 0n456
64 // cdb-check:[...]y = true
65
66 // cdb-command: g
67 // cdb-command: dv
68 // cdb-check:[...]z = 0n10
69 // cdb-check:[...]c = 0n789
70 // cdb-check:[...]a = 0n123
71 // cdb-check:[...]x = 0n42
72 // cdb-check:[...]b = 0n456
73 // cdb-check:[...]y = true
74
75 fn main() {
76     let a = id(123);
77
78     zzz(); // #break
79
80     if let Some(x) = id(Some(42)) {
81         zzz(); // #break
82
83         let b = id(456);
84
85         if let Ok(y) = id::<Result<bool, ()>>(Ok(true)) {
86             zzz(); // #break
87
88             let c = id(789);
89
90             if let (z, 42) = id((10, 42)) {
91                 zzz(); // #break
92             }
93         }
94     }
95 }
96
97 #[inline(never)]
98 fn id<T>(value: T) -> T { value }
99
100 fn zzz() { }