summaryrefslogtreecommitdiffstats
path: root/tests/debuginfo/captured-fields-2.rs
blob: c872354a92489daec52667fd46e14e6b7f781af7 (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
// compile-flags:-g

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

// gdb-command:run
// gdb-command:print my_ref__my_field1
// gdbr-check:$1 = 11
// gdb-command:continue
// gdb-command:print my_var__my_field2
// gdbr-check:$2 = 22
// gdb-command:continue

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

// lldb-command:run
// lldb-command:print my_ref__my_field1
// lldbg-check:(unsigned int) $0 = 11
// lldb-command:continue
// lldb-command:print my_var__my_field2
// lldbg-check:(unsigned int) $1 = 22
// lldb-command:continue

#![feature(capture_disjoint_fields)]
#![allow(unused)]

struct MyStruct {
    my_field1: u32,
    my_field2: u32,
}

fn main() {
    let mut my_var = MyStruct {
        my_field1: 11,
        my_field2: 22,
    };
    let my_ref = &mut my_var;

    let test = || {
        let a = my_ref.my_field1;

        _zzz(); // #break
    };

    test();

    let test = move || {
        let a = my_var.my_field2;

        _zzz(); // #break
    };

    test();
}

fn _zzz() {}