]> git.proxmox.com Git - rustc.git/blob - src/test/debuginfo/generic-method-on-generic-struct.rs
New upstream version 1.46.0~beta.2+dfsg1
[rustc.git] / src / test / debuginfo / generic-method-on-generic-struct.rs
1 // ignore-tidy-linelength
2
3 // compile-flags:-g
4
5 // Some versions of the non-rust-enabled LLDB print the wrong generic
6 // parameter type names in this test.
7 // rust-lldb
8
9 // === GDB TESTS ===================================================================================
10
11 // gdb-command:run
12
13 // STACK BY REF
14 // gdb-command:print *self
15 // gdbg-check:$1 = {x = {__0 = 8888, __1 = -8888}}
16 // gdbr-check:$1 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)}
17 // gdb-command:print arg1
18 // gdb-check:$2 = -1
19 // gdb-command:print arg2
20 // gdb-check:$3 = 2
21 // gdb-command:continue
22
23 // STACK BY VAL
24 // gdb-command:print self
25 // gdbg-check:$4 = {x = {__0 = 8888, __1 = -8888}}
26 // gdbr-check:$4 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)}
27 // gdb-command:print arg1
28 // gdb-check:$5 = -3
29 // gdb-command:print arg2
30 // gdb-check:$6 = -4
31 // gdb-command:continue
32
33 // OWNED BY REF
34 // gdb-command:print *self
35 // gdbg-check:$7 = {x = 1234.5}
36 // gdbr-check:$7 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
37 // gdb-command:print arg1
38 // gdb-check:$8 = -5
39 // gdb-command:print arg2
40 // gdb-check:$9 = -6
41 // gdb-command:continue
42
43 // OWNED BY VAL
44 // gdb-command:print self
45 // gdbg-check:$10 = {x = 1234.5}
46 // gdbr-check:$10 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
47 // gdb-command:print arg1
48 // gdb-check:$11 = -7
49 // gdb-command:print arg2
50 // gdb-check:$12 = -8
51 // gdb-command:continue
52
53 // OWNED MOVED
54 // gdb-command:print *self
55 // gdbg-check:$13 = {x = 1234.5}
56 // gdbr-check:$13 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
57 // gdb-command:print arg1
58 // gdb-check:$14 = -9
59 // gdb-command:print arg2
60 // gdb-check:$15 = -10.5
61 // gdb-command:continue
62
63
64 // === LLDB TESTS ==================================================================================
65
66 // lldb-command:run
67
68 // STACK BY REF
69 // lldb-command:print *self
70 // lldbg-check:[...]$0 = { x = { 0 = 8888, 1 = -8888 } }
71 // lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) *self = { x = { 0 = 8888 1 = -8888 } }
72 // lldb-command:print arg1
73 // lldbg-check:[...]$1 = -1
74 // lldbr-check:(isize) arg1 = -1
75 // lldb-command:print arg2
76 // lldbg-check:[...]$2 = 2
77 // lldbr-check:(u16) arg2 = 2
78 // lldb-command:continue
79
80 // STACK BY VAL
81 // lldb-command:print self
82 // lldbg-check:[...]$3 = { x = { 0 = 8888, 1 = -8888 } }
83 // lldbr-check:(generic_method_on_generic_struct::Struct<(u32, i32)>) self = { x = { 0 = 8888, 1 = -8888 } }
84 // lldb-command:print arg1
85 // lldbg-check:[...]$4 = -3
86 // lldbr-check:(isize) arg1 = -3
87 // lldb-command:print arg2
88 // lldbg-check:[...]$5 = -4
89 // lldbr-check:(i16) arg2 = -4
90 // lldb-command:continue
91
92 // OWNED BY REF
93 // lldb-command:print *self
94 // lldbg-check:[...]$6 = { x = 1234.5 }
95 // lldbr-check:(generic_method_on_generic_struct::Struct<f64>) *self = { x = 1234.5 }
96 // lldb-command:print arg1
97 // lldbg-check:[...]$7 = -5
98 // lldbr-check:(isize) arg1 = -5
99 // lldb-command:print arg2
100 // lldbg-check:[...]$8 = -6
101 // lldbr-check:(i32) arg2 = -6
102 // lldb-command:continue
103
104 // OWNED BY VAL
105 // lldb-command:print self
106 // lldbg-check:[...]$9 = { x = 1234.5 }
107 // lldbr-check:(generic_method_on_generic_struct::Struct<f64>) self = { x = 1234.5 }
108 // lldb-command:print arg1
109 // lldbg-check:[...]$10 = -7
110 // lldbr-check:(isize) arg1 = -7
111 // lldb-command:print arg2
112 // lldbg-check:[...]$11 = -8
113 // lldbr-check:(i64) arg2 = -8
114 // lldb-command:continue
115
116 // OWNED MOVED
117 // lldb-command:print *self
118 // lldbg-check:[...]$12 = { x = 1234.5 }
119 // lldbr-check:(generic_method_on_generic_struct::Struct<f64>) *self = { x = 1234.5 }
120 // lldb-command:print arg1
121 // lldbg-check:[...]$13 = -9
122 // lldbr-check:(isize) arg1 = -9
123 // lldb-command:print arg2
124 // lldbg-check:[...]$14 = -10.5
125 // lldbr-check:(f32) arg2 = -10.5
126 // lldb-command:continue
127
128 #![feature(box_syntax)]
129 #![feature(omit_gdb_pretty_printer_section)]
130 #![omit_gdb_pretty_printer_section]
131
132 #[derive(Copy, Clone)]
133 struct Struct<T> {
134 x: T
135 }
136
137 impl<T1> Struct<T1> {
138
139 fn self_by_ref<T2>(&self, arg1: isize, arg2: T2) -> isize {
140 zzz(); // #break
141 arg1
142 }
143
144 fn self_by_val<T2>(self, arg1: isize, arg2: T2) -> isize {
145 zzz(); // #break
146 arg1
147 }
148
149 fn self_owned<T2>(self: Box<Struct<T1>>, arg1: isize, arg2: T2) -> isize {
150 zzz(); // #break
151 arg1
152 }
153 }
154
155 fn main() {
156 let stack = Struct { x: (8888_u32, -8888_i32) };
157 let _ = stack.self_by_ref(-1, 2_u16);
158 let _ = stack.self_by_val(-3, -4_i16);
159
160 let owned: Box<_> = box Struct { x: 1234.5f64 };
161 let _ = owned.self_by_ref(-5, -6_i32);
162 let _ = owned.self_by_val(-7, -8_i64);
163 let _ = owned.self_owned(-9, -10.5_f32);
164 }
165
166 fn zzz() {()}