]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/borrowed-struct.rs
Rollup merge of #107580 - lenko-d:default_value_for_a_lifetime_generic_parameter_prod...
[rust.git] / tests / debuginfo / borrowed-struct.rs
1 // compile-flags:-g
2 // min-lldb-version: 310
3
4 // === GDB TESTS ===================================================================================
5
6 // gdb-command:run
7
8 // gdb-command:print *stack_val_ref
9 // gdbg-check:$1 = {x = 10, y = 23.5}
10 // gdbr-check:$1 = borrowed_struct::SomeStruct {x: 10, y: 23.5}
11
12 // gdb-command:print *stack_val_interior_ref_1
13 // gdb-check:$2 = 10
14
15 // gdb-command:print *stack_val_interior_ref_2
16 // gdb-check:$3 = 23.5
17
18 // gdb-command:print *ref_to_unnamed
19 // gdbg-check:$4 = {x = 11, y = 24.5}
20 // gdbr-check:$4 = borrowed_struct::SomeStruct {x: 11, y: 24.5}
21
22 // gdb-command:print *unique_val_ref
23 // gdbg-check:$5 = {x = 13, y = 26.5}
24 // gdbr-check:$5 = borrowed_struct::SomeStruct {x: 13, y: 26.5}
25
26 // gdb-command:print *unique_val_interior_ref_1
27 // gdb-check:$6 = 13
28
29 // gdb-command:print *unique_val_interior_ref_2
30 // gdb-check:$7 = 26.5
31
32
33 // === LLDB TESTS ==================================================================================
34
35 // lldb-command:run
36
37 // lldb-command:print *stack_val_ref
38 // lldbg-check:[...]$0 = { x = 10 y = 23.5 }
39 // lldbr-check:(borrowed_struct::SomeStruct) *stack_val_ref = (x = 10, y = 23.5)
40
41 // lldb-command:print *stack_val_interior_ref_1
42 // lldbg-check:[...]$1 = 10
43 // lldbr-check:(isize) *stack_val_interior_ref_1 = 10
44
45 // lldb-command:print *stack_val_interior_ref_2
46 // lldbg-check:[...]$2 = 23.5
47 // lldbr-check:(f64) *stack_val_interior_ref_2 = 23.5
48
49 // lldb-command:print *ref_to_unnamed
50 // lldbg-check:[...]$3 = { x = 11 y = 24.5 }
51 // lldbr-check:(borrowed_struct::SomeStruct) *ref_to_unnamed = (x = 11, y = 24.5)
52
53 // lldb-command:print *unique_val_ref
54 // lldbg-check:[...]$4 = { x = 13 y = 26.5 }
55 // lldbr-check:(borrowed_struct::SomeStruct) *unique_val_ref = (x = 13, y = 26.5)
56
57 // lldb-command:print *unique_val_interior_ref_1
58 // lldbg-check:[...]$5 = 13
59 // lldbr-check:(isize) *unique_val_interior_ref_1 = 13
60
61 // lldb-command:print *unique_val_interior_ref_2
62 // lldbg-check:[...]$6 = 26.5
63 // lldbr-check:(f64) *unique_val_interior_ref_2 = 26.5
64
65 #![allow(unused_variables)]
66 #![feature(omit_gdb_pretty_printer_section)]
67 #![omit_gdb_pretty_printer_section]
68
69 struct SomeStruct {
70     x: isize,
71     y: f64
72 }
73
74 fn main() {
75     let stack_val: SomeStruct = SomeStruct { x: 10, y: 23.5 };
76     let stack_val_ref: &SomeStruct = &stack_val;
77     let stack_val_interior_ref_1: &isize = &stack_val.x;
78     let stack_val_interior_ref_2: &f64 = &stack_val.y;
79     let ref_to_unnamed: &SomeStruct = &SomeStruct { x: 11, y: 24.5 };
80
81     let unique_val: Box<_> = Box::new(SomeStruct { x: 13, y: 26.5 });
82     let unique_val_ref: &SomeStruct = &*unique_val;
83     let unique_val_interior_ref_1: &isize = &unique_val.x;
84     let unique_val_interior_ref_2: &f64 = &unique_val.y;
85
86     zzz(); // #break
87 }
88
89 fn zzz() {()}