blob: 9f0b0ea84142d1e8b6244c31f37d7db7d6c974d2 [file] [log] [blame]
Michael Woeristerc1734ce2013-08-15 10:25:351// Copyright 2013 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
Young-il Choica553172013-11-09 07:16:4411// xfail-android: FIXME(#10381)
sh8281.kim4e548282013-11-04 06:53:0112
Michael Woeristerc1734ce2013-08-15 10:25:3513// compile-flags:-Z extra-debug-info
Michael Woerister93d63282013-09-06 14:00:0814// debugger:rbreak zzz
Michael Woeristerc1734ce2013-08-15 10:25:3515// debugger:run
16
17// STACK BY REF
18// debugger:finish
19// debugger:print *self
20// check:$1 = {x = 100}
21// debugger:print arg1
22// check:$2 = -1
23// debugger:print arg2
24// check:$3 = -2
25// debugger:continue
26
27// STACK BY VAL
28// debugger:finish
Michael Woerister01fae5f2013-12-17 15:54:2229// debugger:print self
30// check:$4 = {x = 100}
Michael Woeristerc1734ce2013-08-15 10:25:3531// debugger:print arg1
Michael Woerister01fae5f2013-12-17 15:54:2232// check:$5 = -3
Michael Woeristerc1734ce2013-08-15 10:25:3533// debugger:print arg2
Michael Woerister01fae5f2013-12-17 15:54:2234// check:$6 = -4
Michael Woeristerc1734ce2013-08-15 10:25:3535// debugger:continue
36
37// OWNED BY REF
38// debugger:finish
39// debugger:print *self
Michael Woerister01fae5f2013-12-17 15:54:2240// check:$7 = {x = 200}
Michael Woeristerc1734ce2013-08-15 10:25:3541// debugger:print arg1
Michael Woerister01fae5f2013-12-17 15:54:2242// check:$8 = -5
Michael Woeristerc1734ce2013-08-15 10:25:3543// debugger:print arg2
Michael Woerister01fae5f2013-12-17 15:54:2244// check:$9 = -6
Michael Woeristerc1734ce2013-08-15 10:25:3545// debugger:continue
46
47// OWNED BY VAL
48// debugger:finish
Michael Woerister01fae5f2013-12-17 15:54:2249// debugger:print self
50// check:$10 = {x = 200}
Michael Woeristerc1734ce2013-08-15 10:25:3551// debugger:print arg1
Michael Woerister01fae5f2013-12-17 15:54:2252// check:$11 = -7
Michael Woeristerc1734ce2013-08-15 10:25:3553// debugger:print arg2
Michael Woerister01fae5f2013-12-17 15:54:2254// check:$12 = -8
Michael Woeristerc1734ce2013-08-15 10:25:3555// debugger:continue
56
57// OWNED MOVED
58// debugger:finish
59// debugger:print *self
Michael Woerister01fae5f2013-12-17 15:54:2260// check:$13 = {x = 200}
Michael Woeristerc1734ce2013-08-15 10:25:3561// debugger:print arg1
Michael Woerister01fae5f2013-12-17 15:54:2262// check:$14 = -9
Michael Woeristerc1734ce2013-08-15 10:25:3563// debugger:print arg2
Michael Woerister01fae5f2013-12-17 15:54:2264// check:$15 = -10
Michael Woeristerc1734ce2013-08-15 10:25:3565// debugger:continue
66
Michael Woeristerc1734ce2013-08-15 10:25:3567struct Struct {
68 x: int
69}
70
71trait Trait {
72 fn self_by_ref(&self, arg1: int, arg2: int) -> int {
73 zzz();
74 arg1 + arg2
75 }
76
77 fn self_by_val(self, arg1: int, arg2: int) -> int {
78 zzz();
79 arg1 + arg2
80 }
81
82 fn self_owned(~self, arg1: int, arg2: int) -> int {
83 zzz();
84 arg1 + arg2
85 }
Michael Woeristerc1734ce2013-08-15 10:25:3586}
87
Alex Crichton4b266f12013-09-19 19:09:5288impl Trait for Struct {}
Michael Woeristerc1734ce2013-08-15 10:25:3589
90fn main() {
91 let stack = Struct { x: 100 };
92 let _ = stack.self_by_ref(-1, -2);
93 let _ = stack.self_by_val(-3, -4);
94
95 let owned = ~Struct { x: 200 };
96 let _ = owned.self_by_ref(-5, -6);
97 let _ = owned.self_by_val(-7, -8);
98 let _ = owned.self_owned(-9, -10);
Michael Woeristerc1734ce2013-08-15 10:25:3599}
100
101fn zzz() {()}