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