]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/generic-method-on-generic-struct.rs
Remove astconv usage in diagnostic
[rust.git] / tests / debuginfo / generic-method-on-generic-struct.rs
1 // compile-flags:-g
2
3 // Some versions of the non-rust-enabled LLDB print the wrong generic
4 // parameter type names in this test.
5 // rust-lldb
6
7 // === GDB TESTS ===================================================================================
8
9 // gdb-command:run
10
11 // STACK BY REF
12 // gdb-command:print *self
13 // gdbg-check:$1 = {x = {__0 = 8888, __1 = -8888}}
14 // gdbr-check:$1 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)}
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
23 // gdbg-check:$4 = {x = {__0 = 8888, __1 = -8888}}
24 // gdbr-check:$4 = generic_method_on_generic_struct::Struct<(u32, i32)> {x: (8888, -8888)}
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
33 // gdbg-check:$7 = {x = 1234.5}
34 // gdbr-check:$7 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
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
43 // gdbg-check:$10 = {x = 1234.5}
44 // gdbr-check:$10 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
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
53 // gdbg-check:$13 = {x = 1234.5}
54 // gdbr-check:$13 = generic_method_on_generic_struct::Struct<f64> {x: 1234.5}
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
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 } }
70 // lldb-command:print arg1
71 // lldbg-check:[...]$1 = -1
72 // lldbr-check:(isize) arg1 = -1
73 // lldb-command:print arg2
74 // lldbg-check:[...]$2 = 2
75 // lldbr-check:(u16) arg2 = 2
76 // lldb-command:continue
77
78 // STACK BY VAL
79 // lldb-command:print self
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 } }
82 // lldb-command:print arg1
83 // lldbg-check:[...]$4 = -3
84 // lldbr-check:(isize) arg1 = -3
85 // lldb-command:print arg2
86 // lldbg-check:[...]$5 = -4
87 // lldbr-check:(i16) arg2 = -4
88 // lldb-command:continue
89
90 // OWNED BY REF
91 // lldb-command:print *self
92 // lldbg-check:[...]$6 = { x = 1234.5 }
93 // lldbr-check:(generic_method_on_generic_struct::Struct<f64>) *self = { x = 1234.5 }
94 // lldb-command:print arg1
95 // lldbg-check:[...]$7 = -5
96 // lldbr-check:(isize) arg1 = -5
97 // lldb-command:print arg2
98 // lldbg-check:[...]$8 = -6
99 // lldbr-check:(i32) arg2 = -6
100 // lldb-command:continue
101
102 // OWNED BY VAL
103 // lldb-command:print self
104 // lldbg-check:[...]$9 = { x = 1234.5 }
105 // lldbr-check:(generic_method_on_generic_struct::Struct<f64>) self = { x = 1234.5 }
106 // lldb-command:print arg1
107 // lldbg-check:[...]$10 = -7
108 // lldbr-check:(isize) arg1 = -7
109 // lldb-command:print arg2
110 // lldbg-check:[...]$11 = -8
111 // lldbr-check:(i64) arg2 = -8
112 // lldb-command:continue
113
114 // OWNED MOVED
115 // lldb-command:print *self
116 // lldbg-check:[...]$12 = { x = 1234.5 }
117 // lldbr-check:(generic_method_on_generic_struct::Struct<f64>) *self = { x = 1234.5 }
118 // lldb-command:print arg1
119 // lldbg-check:[...]$13 = -9
120 // lldbr-check:(isize) arg1 = -9
121 // lldb-command:print arg2
122 // lldbg-check:[...]$14 = -10.5
123 // lldbr-check:(f32) arg2 = -10.5
124 // lldb-command:continue
125
126 #![feature(omit_gdb_pretty_printer_section)]
127 #![omit_gdb_pretty_printer_section]
128
129 #[derive(Copy, Clone)]
130 struct Struct<T> {
131     x: T
132 }
133
134 impl<T1> Struct<T1> {
135
136     fn self_by_ref<T2>(&self, arg1: isize, arg2: T2) -> isize {
137         zzz(); // #break
138         arg1
139     }
140
141     fn self_by_val<T2>(self, arg1: isize, arg2: T2) -> isize {
142         zzz(); // #break
143         arg1
144     }
145
146     fn self_owned<T2>(self: Box<Struct<T1>>, arg1: isize, arg2: T2) -> isize {
147         zzz(); // #break
148         arg1
149     }
150 }
151
152 fn main() {
153     let stack = Struct { x: (8888_u32, -8888_i32) };
154     let _ = stack.self_by_ref(-1, 2_u16);
155     let _ = stack.self_by_val(-3, -4_i16);
156
157     let owned: Box<_> = Box::new(Struct { x: 1234.5f64 });
158     let _ = owned.self_by_ref(-5, -6_i32);
159     let _ = owned.self_by_val(-7, -8_i64);
160     let _ = owned.self_owned(-9, -10.5_f32);
161 }
162
163 fn zzz() {()}