]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/by-value-self-argument-in-trait-impl.rs
Auto merge of #23934 - lfairy:write-no-deref, r=alexcrichton
[rust.git] / src / test / debuginfo / by-value-self-argument-in-trait-impl.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 // gdb-command:print self
20 // gdb-check:$1 = 1111
21 // gdb-command:continue
22
23 // gdb-command:print self
24 // gdb-check:$2 = {x = 2222, y = 3333}
25 // gdb-command:continue
26
27 // gdb-command:print self
28 // gdb-check:$3 = {4444.5, 5555, 6666, 7777.5}
29 // gdb-command:continue
30
31
32 // === LLDB TESTS ==================================================================================
33
34 // lldb-command:run
35
36 // lldb-command:print self
37 // lldb-check:[...]$0 = 1111
38 // lldb-command:continue
39
40 // lldb-command:print self
41 // lldb-check:[...]$1 = Struct { x: 2222, y: 3333 }
42 // lldb-command:continue
43
44 // lldb-command:print self
45 // lldb-check:[...]$2 = (4444.5, 5555, 6666, 7777.5)
46 // lldb-command:continue
47
48 #![omit_gdb_pretty_printer_section]
49
50 trait Trait {
51     fn method(self) -> Self;
52 }
53
54 impl Trait for isize {
55     fn method(self) -> isize {
56         zzz(); // #break
57         self
58     }
59 }
60
61 struct Struct {
62     x: usize,
63     y: usize,
64 }
65
66 impl Trait for Struct {
67     fn method(self) -> Struct {
68         zzz(); // #break
69         self
70     }
71 }
72
73 impl Trait for (f64, isize, isize, f64) {
74     fn method(self) -> (f64, isize, isize, f64) {
75         zzz(); // #break
76         self
77     }
78 }
79
80 fn main() {
81     let _ = (1111 as isize).method();
82     let _ = Struct { x: 2222, y: 3333 }.method();
83     let _ = (4444.5, 5555, 6666, 7777.5).method();
84 }
85
86 fn zzz() { () }