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