]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/captured-fields-1.rs
Move /src/test to /tests
[rust.git] / tests / debuginfo / captured-fields-1.rs
1 // compile-flags:-g
2
3 // === GDB TESTS ===================================================================================
4
5 // gdb-command:run
6 // gdb-command:print test
7 // gdbr-check:$1 = captured_fields_1::main::{closure_env#0} {_ref__my_ref__my_field1: 0x[...]}
8 // gdb-command:continue
9 // gdb-command:print test
10 // gdbr-check:$2 = captured_fields_1::main::{closure_env#1} {_ref__my_ref__my_field2: 0x[...]}
11 // gdb-command:continue
12 // gdb-command:print test
13 // gdbr-check:$3 = captured_fields_1::main::{closure_env#2} {_ref__my_ref: 0x[...]}
14 // gdb-command:continue
15 // gdb-command:print test
16 // gdbr-check:$4 = captured_fields_1::main::{closure_env#3} {my_ref: 0x[...]}
17 // gdb-command:continue
18 // gdb-command:print test
19 // gdbr-check:$5 = captured_fields_1::main::{closure_env#4} {my_var__my_field2: 22}
20 // gdb-command:continue
21 // gdb-command:print test
22 // gdbr-check:$6 = captured_fields_1::main::{closure_env#5} {my_var: captured_fields_1::MyStruct {my_field1: 11, my_field2: 22}}
23 // gdb-command:continue
24
25 // === LLDB TESTS ==================================================================================
26
27 // lldb-command:run
28 // lldb-command:print test
29 // lldbg-check:(captured_fields_1::main::{closure_env#0}) $0 = { _ref__my_ref__my_field1 = 0x[...] }
30 // lldb-command:continue
31 // lldb-command:print test
32 // lldbg-check:(captured_fields_1::main::{closure_env#1}) $1 = { _ref__my_ref__my_field2 = 0x[...] }
33 // lldb-command:continue
34 // lldb-command:print test
35 // lldbg-check:(captured_fields_1::main::{closure_env#2}) $2 = { _ref__my_ref = 0x[...] }
36 // lldb-command:continue
37 // lldb-command:print test
38 // lldbg-check:(captured_fields_1::main::{closure_env#3}) $3 = { my_ref = 0x[...] }
39 // lldb-command:continue
40 // lldb-command:print test
41 // lldbg-check:(captured_fields_1::main::{closure_env#4}) $4 = { my_var__my_field2 = 22 }
42 // lldb-command:continue
43 // lldb-command:print test
44 // lldbg-check:(captured_fields_1::main::{closure_env#5}) $5 = { my_var = { my_field1 = 11 my_field2 = 22 } }
45 // lldb-command:continue
46
47 #![feature(capture_disjoint_fields)]
48 #![allow(unused)]
49
50 struct MyStruct {
51     my_field1: u32,
52     my_field2: u32,
53 }
54
55 fn main() {
56     let mut my_var = MyStruct { my_field1: 11, my_field2: 22 };
57     let my_ref = &mut my_var;
58
59     let test = || {
60         let a = &mut my_ref.my_field1;
61     };
62
63     _zzz(); // #break
64
65     let test = || {
66         let a = &my_ref.my_field2;
67     };
68
69     _zzz(); // #break
70
71     let test = || {
72         let a = &my_ref;
73     };
74
75     _zzz(); // #break
76
77     let test = || {
78         let a = my_ref;
79     };
80
81     _zzz(); // #break
82
83     let test = move || {
84         let a = my_var.my_field2;
85     };
86
87     _zzz(); // #break
88
89     let test = || {
90         let a = my_var;
91     };
92
93     _zzz(); // #break
94 }
95
96 fn _zzz() {}