summaryrefslogtreecommitdiffstats
path: root/src/test/debuginfo/lexical-scope-in-if-let.rs
blob: 8fee459bd7ac778113bdc5b523ccfa2c36cc9767 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
// compile-flags:-g

// === GDB TESTS ==================================================================================

// gdb-command:run
// gdb-command:info locals
// gdb-check:a = 123

// gdb-command:continue
// gdb-command:info locals
// gdb-check:x = 42
// gdb-check:a = 123

// gdb-command:continue
// gdb-command:info locals
// gdb-check:y = true
// gdb-check:b = 456
// gdb-check:x = 42
// gdb-check:a = 123

// gdb-command:continue
// gdb-command:info locals
// gdb-check:z = 10
// gdb-check:c = 789
// gdb-check:y = true
// gdb-check:b = 456
// gdb-check:x = 42
// gdb-check:a = 123

// === LLDB TESTS =================================================================================

// lldb-command:run
// lldb-command:frame variable
// lldb-check:(int) a = 123

// lldb-command:continue
// lldb-command:frame variable
// lldb-check:(int) a = 123 (int) x = 42

// lldb-command:continue
// lldb-command:frame variable
// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true

// lldb-command:continue
// lldb-command:frame variable
// lldb-check:(int) a = 123 (int) x = 42 (int) b = 456 (bool) y = true (int) c = 789 (int) z = 10

// === CDB TESTS ==================================================================================

// cdb-command: g
// cdb-command: dv
// cdb-check:[...]a = 0n123

// cdb-command: g
// cdb-command: dv
// cdb-check:[...]a = 0n123
// cdb-check:[...]x = 0n42

// cdb-command: g
// cdb-command: dv
// cdb-check:[...]a = 0n123
// cdb-check:[...]x = 0n42
// cdb-check:[...]b = 0n456
// cdb-check:[...]y = true

// cdb-command: g
// cdb-command: dv
// cdb-check:[...]z = 0n10
// cdb-check:[...]c = 0n789
// cdb-check:[...]a = 0n123
// cdb-check:[...]x = 0n42
// cdb-check:[...]b = 0n456
// cdb-check:[...]y = true

fn main() {
    let a = id(123);

    zzz(); // #break

    if let Some(x) = id(Some(42)) {
        zzz(); // #break

        let b = id(456);

        if let Ok(y) = id::<Result<bool, ()>>(Ok(true)) {
            zzz(); // #break

            let c = id(789);

            if let (z, 42) = id((10, 42)) {
                zzz(); // #break
            }
        }
    }
}

#[inline(never)]
fn id<T>(value: T) -> T { value }

fn zzz() { }