]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/self-in-generic-default-method.rs
auto merge of #19628 : jbranchaud/rust/add-string-as-string-doctest, r=steveklabnik
[rust.git] / src / test / debuginfo / self-in-generic-default-method.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 // ignore-android: FIXME(#10381)
12 // min-lldb-version: 310
13
14 // compile-flags:-g
15
16 // === GDB TESTS ===================================================================================
17
18 // gdb-command:run
19
20 // STACK BY REF
21 // gdb-command:print *self
22 // gdb-check:$1 = {x = 987}
23 // gdb-command:print arg1
24 // gdb-check:$2 = -1
25 // gdb-command:print arg2
26 // gdb-check:$3 = 2
27 // gdb-command:continue
28
29 // STACK BY VAL
30 // gdb-command:print self
31 // gdb-check:$4 = {x = 987}
32 // gdb-command:print arg1
33 // gdb-check:$5 = -3
34 // gdb-command:print arg2
35 // gdb-check:$6 = -4
36 // gdb-command:continue
37
38 // OWNED BY REF
39 // gdb-command:print *self
40 // gdb-check:$7 = {x = 879}
41 // gdb-command:print arg1
42 // gdb-check:$8 = -5
43 // gdb-command:print arg2
44 // gdb-check:$9 = -6
45 // gdb-command:continue
46
47 // OWNED BY VAL
48 // gdb-command:print self
49 // gdb-check:$10 = {x = 879}
50 // gdb-command:print arg1
51 // gdb-check:$11 = -7
52 // gdb-command:print arg2
53 // gdb-check:$12 = -8
54 // gdb-command:continue
55
56 // OWNED MOVED
57 // gdb-command:print *self
58 // gdb-check:$13 = {x = 879}
59 // gdb-command:print arg1
60 // gdb-check:$14 = -9
61 // gdb-command:print arg2
62 // gdb-check:$15 = -10.5
63 // gdb-command:continue
64
65
66 // === LLDB TESTS ==================================================================================
67
68 // lldb-command:run
69
70 // STACK BY REF
71 // lldb-command:print *self
72 // lldb-check:[...]$0 = Struct { x: 987 }
73 // lldb-command:print arg1
74 // lldb-check:[...]$1 = -1
75 // lldb-command:print arg2
76 // lldb-check:[...]$2 = 2
77 // lldb-command:continue
78
79 // STACK BY VAL
80 // lldb-command:print self
81 // lldb-check:[...]$3 = Struct { x: 987 }
82 // lldb-command:print arg1
83 // lldb-check:[...]$4 = -3
84 // lldb-command:print arg2
85 // lldb-check:[...]$5 = -4
86 // lldb-command:continue
87
88 // OWNED BY REF
89 // lldb-command:print *self
90 // lldb-check:[...]$6 = Struct { x: 879 }
91 // lldb-command:print arg1
92 // lldb-check:[...]$7 = -5
93 // lldb-command:print arg2
94 // lldb-check:[...]$8 = -6
95 // lldb-command:continue
96
97 // OWNED BY VAL
98 // lldb-command:print self
99 // lldb-check:[...]$9 = Struct { x: 879 }
100 // lldb-command:print arg1
101 // lldb-check:[...]$10 = -7
102 // lldb-command:print arg2
103 // lldb-check:[...]$11 = -8
104 // lldb-command:continue
105
106 // OWNED MOVED
107 // lldb-command:print *self
108 // lldb-check:[...]$12 = Struct { x: 879 }
109 // lldb-command:print arg1
110 // lldb-check:[...]$13 = -9
111 // lldb-command:print arg2
112 // lldb-check:[...]$14 = -10.5
113 // lldb-command:continue
114
115
116 struct Struct {
117     x: int
118 }
119
120 trait Trait {
121
122     fn self_by_ref<T>(&self, arg1: int, arg2: T) -> int {
123         zzz(); // #break
124         arg1
125     }
126
127     fn self_by_val<T>(self, arg1: int, arg2: T) -> int {
128         zzz(); // #break
129         arg1
130     }
131
132     fn self_owned<T>(self: Box<Self>, arg1: int, arg2: T) -> int {
133         zzz(); // #break
134         arg1
135     }
136 }
137
138 impl Trait for Struct {}
139
140 fn main() {
141     let stack = Struct { x: 987 };
142     let _ = stack.self_by_ref(-1, 2_u16);
143     let _ = stack.self_by_val(-3, -4_i16);
144
145     let owned = box Struct { x: 879 };
146     let _ = owned.self_by_ref(-5, -6_i32);
147     let _ = owned.self_by_val(-7, -8_i64);
148     let _ = owned.self_owned(-9, -10.5_f32);
149 }
150
151 fn zzz() {()}
152
153 impl Copy for Struct {}
154