]> git.proxmox.com Git - rustc.git/blob - src/test/debuginfo/method-on-generic-struct.rs
Merge tag 'upstream/1.5.0+dfsg1'
[rustc.git] / src / test / debuginfo / method-on-generic-struct.rs
1 // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // min-lldb-version: 310
12
13 // compile-flags:-g
14
15 // === GDB TESTS ===================================================================================
16
17 // gdb-command:run
18
19 // STACK BY REF
20 // gdb-command:print *self
21 // gdb-check:$1 = {x = {__0 = 8888, __1 = -8888}}
22 // gdb-command:print arg1
23 // gdb-check:$2 = -1
24 // gdb-command:print arg2
25 // gdb-check:$3 = -2
26 // gdb-command:continue
27
28 // STACK BY VAL
29 // gdb-command:print self
30 // gdb-check:$4 = {x = {__0 = 8888, __1 = -8888}}
31 // gdb-command:print arg1
32 // gdb-check:$5 = -3
33 // gdb-command:print arg2
34 // gdb-check:$6 = -4
35 // gdb-command:continue
36
37 // OWNED BY REF
38 // gdb-command:print *self
39 // gdb-check:$7 = {x = 1234.5}
40 // gdb-command:print arg1
41 // gdb-check:$8 = -5
42 // gdb-command:print arg2
43 // gdb-check:$9 = -6
44 // gdb-command:continue
45
46 // OWNED BY VAL
47 // gdb-command:print self
48 // gdb-check:$10 = {x = 1234.5}
49 // gdb-command:print arg1
50 // gdb-check:$11 = -7
51 // gdb-command:print arg2
52 // gdb-check:$12 = -8
53 // gdb-command:continue
54
55 // OWNED MOVED
56 // gdb-command:print *self
57 // gdb-check:$13 = {x = 1234.5}
58 // gdb-command:print arg1
59 // gdb-check:$14 = -9
60 // gdb-command:print arg2
61 // gdb-check:$15 = -10
62 // gdb-command:continue
63
64
65 // === LLDB TESTS ==================================================================================
66
67 // lldb-command:run
68
69 // STACK BY REF
70 // lldb-command:print *self
71 // lldb-check:[...]$0 = Struct<(u32, i32)> { x: (8888, -8888) }
72 // lldb-command:print arg1
73 // lldb-check:[...]$1 = -1
74 // lldb-command:print arg2
75 // lldb-check:[...]$2 = -2
76 // lldb-command:continue
77
78 // STACK BY VAL
79 // lldb-command:print self
80 // lldb-check:[...]$3 = Struct<(u32, i32)> { x: (8888, -8888) }
81 // lldb-command:print arg1
82 // lldb-check:[...]$4 = -3
83 // lldb-command:print arg2
84 // lldb-check:[...]$5 = -4
85 // lldb-command:continue
86
87 // OWNED BY REF
88 // lldb-command:print *self
89 // lldb-check:[...]$6 = Struct<f64> { x: 1234.5 }
90 // lldb-command:print arg1
91 // lldb-check:[...]$7 = -5
92 // lldb-command:print arg2
93 // lldb-check:[...]$8 = -6
94 // lldb-command:continue
95
96 // OWNED BY VAL
97 // lldb-command:print self
98 // lldb-check:[...]$9 = Struct<f64> { x: 1234.5 }
99 // lldb-command:print arg1
100 // lldb-check:[...]$10 = -7
101 // lldb-command:print arg2
102 // lldb-check:[...]$11 = -8
103 // lldb-command:continue
104
105 // OWNED MOVED
106 // lldb-command:print *self
107 // lldb-check:[...]$12 = Struct<f64> { x: 1234.5 }
108 // lldb-command:print arg1
109 // lldb-check:[...]$13 = -9
110 // lldb-command:print arg2
111 // lldb-check:[...]$14 = -10
112 // lldb-command:continue
113
114
115 #![feature(box_syntax)]
116 #![feature(omit_gdb_pretty_printer_section)]
117 #![omit_gdb_pretty_printer_section]
118
119 #[derive(Copy, Clone)]
120 struct Struct<T> {
121 x: T
122 }
123
124 impl<T> Struct<T> {
125
126 fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
127 zzz(); // #break
128 arg1 + arg2
129 }
130
131 fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
132 zzz(); // #break
133 arg1 + arg2
134 }
135
136 fn self_owned(self: Box<Struct<T>>, arg1: isize, arg2: isize) -> isize {
137 zzz(); // #break
138 arg1 + arg2
139 }
140 }
141
142 fn main() {
143 let stack = Struct { x: (8888_u32, -8888_i32) };
144 let _ = stack.self_by_ref(-1, -2);
145 let _ = stack.self_by_val(-3, -4);
146
147 let owned: Box<_> = box Struct { x: 1234.5f64 };
148 let _ = owned.self_by_ref(-5, -6);
149 let _ = owned.self_by_val(-7, -8);
150 let _ = owned.self_owned(-9, -10);
151 }
152
153 fn zzz() {()}