]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/generic-function.rs
Auto merge of #61421 - vorner:string-in-rc-into-raw-docs, r=RalfJung
[rust.git] / src / test / debuginfo / generic-function.rs
1 // ignore-tidy-linelength
2
3 // min-lldb-version: 310
4
5 // compile-flags:-g
6
7 // === GDB TESTS ===================================================================================
8
9 // gdb-command:run
10
11 // gdb-command:print *t0
12 // gdb-check:$1 = 1
13 // gdb-command:print *t1
14 // gdb-check:$2 = 2.5
15 // gdb-command:print ret
16 // gdbg-check:$3 = {__0 = {__0 = 1, __1 = 2.5}, __1 = {__0 = 2.5, __1 = 1}}
17 // gdbr-check:$3 = ((1, 2.5), (2.5, 1))
18 // gdb-command:continue
19
20 // gdb-command:print *t0
21 // gdb-check:$4 = 3.5
22 // gdb-command:print *t1
23 // gdb-check:$5 = 4
24 // gdb-command:print ret
25 // gdbg-check:$6 = {__0 = {__0 = 3.5, __1 = 4}, __1 = {__0 = 4, __1 = 3.5}}
26 // gdbr-check:$6 = ((3.5, 4), (4, 3.5))
27 // gdb-command:continue
28
29 // gdb-command:print *t0
30 // gdb-check:$7 = 5
31 // gdb-command:print *t1
32 // gdbg-check:$8 = {a = 6, b = 7.5}
33 // gdbr-check:$8 = generic_function::Struct {a: 6, b: 7.5}
34 // gdb-command:print ret
35 // gdbg-check:$9 = {__0 = {__0 = 5, __1 = {a = 6, b = 7.5}}, __1 = {__0 = {a = 6, b = 7.5}, __1 = 5}}
36 // gdbr-check:$9 = ((5, generic_function::Struct {a: 6, b: 7.5}), (generic_function::Struct {a: 6, b: 7.5}, 5))
37 // gdb-command:continue
38
39
40 // === LLDB TESTS ==================================================================================
41
42 // lldb-command:run
43
44 // lldb-command:print *t0
45 // lldbg-check:[...]$0 = 1
46 // lldbr-check:(i32) *t0 = 1
47 // lldb-command:print *t1
48 // lldbg-check:[...]$1 = 2.5
49 // lldbr-check:(f64) *t1 = 2.5
50 // lldb-command:print ret
51 // lldbg-check:[...]$2 = ((1, 2.5), (2.5, 1))
52 // lldbr-check:(((i32, f64), (f64, i32))) ret = { = { = 1 = 2.5 } = { = 2.5 = 1 } }
53 // lldb-command:continue
54
55 // lldb-command:print *t0
56 // lldbg-check:[...]$3 = 3.5
57 // lldbr-check:(f64) *t0 = 3.5
58 // lldb-command:print *t1
59 // lldbg-check:[...]$4 = 4
60 // lldbr-check:(u16) *t1 = 4
61 // lldb-command:print ret
62 // lldbg-check:[...]$5 = ((3.5, 4), (4, 3.5))
63 // lldbr-check:(((f64, u16), (u16, f64))) ret = { = { = 3.5 = 4 } = { = 4 = 3.5 } }
64 // lldb-command:continue
65
66 // lldb-command:print *t0
67 // lldbg-check:[...]$6 = 5
68 // lldbr-check:(i32) *t0 = 5
69 // lldb-command:print *t1
70 // lldbg-check:[...]$7 = Struct { a: 6, b: 7.5 }
71 // lldbr-check:(generic_function::Struct) *t1 = Struct { a: 6, b: 7.5 }
72 // lldb-command:print ret
73 // lldbg-check:[...]$8 = ((5, Struct { a: 6, b: 7.5 }), (Struct { a: 6, b: 7.5 }, 5))
74 // lldbr-check:(((i32, generic_function::Struct), (generic_function::Struct, i32))) ret = { = { = 5 = Struct { a: 6, b: 7.5 } } = { = Struct { a: 6, b: 7.5 } = 5 } }
75 // lldb-command:continue
76
77 #![feature(omit_gdb_pretty_printer_section)]
78 #![omit_gdb_pretty_printer_section]
79
80 #[derive(Clone)]
81 struct Struct {
82     a: isize,
83     b: f64
84 }
85
86 fn dup_tup<T0: Clone, T1: Clone>(t0: &T0, t1: &T1) -> ((T0, T1), (T1, T0)) {
87     let ret = ((t0.clone(), t1.clone()), (t1.clone(), t0.clone()));
88     zzz(); // #break
89     ret
90 }
91
92 fn main() {
93
94     let _ = dup_tup(&1, &2.5f64);
95     let _ = dup_tup(&3.5f64, &4_u16);
96     let _ = dup_tup(&5, &Struct { a: 6, b: 7.5 });
97 }
98
99 fn zzz() {()}