]> git.lizzy.rs Git - rust.git/blob - tests/debuginfo/by-value-self-argument-in-trait-impl.rs
Rollup merge of #107769 - compiler-errors:pointer-like, r=eholk
[rust.git] / tests / debuginfo / by-value-self-argument-in-trait-impl.rs
1 // min-lldb-version: 310
2
3 // compile-flags:-g
4
5 // === GDB TESTS ===================================================================================
6
7 // gdb-command:run
8
9 // gdb-command:print self
10 // gdb-check:$1 = 1111
11 // gdb-command:continue
12
13 // gdb-command:print self
14 // gdbg-check:$2 = {x = 2222, y = 3333}
15 // gdbr-check:$2 = by_value_self_argument_in_trait_impl::Struct {x: 2222, y: 3333}
16 // gdb-command:continue
17
18 // gdb-command:print self
19 // gdbg-check:$3 = {__0 = 4444.5, __1 = 5555, __2 = 6666, __3 = 7777.5}
20 // gdbr-check:$3 = (4444.5, 5555, 6666, 7777.5)
21 // gdb-command:continue
22
23
24 // === LLDB TESTS ==================================================================================
25
26 // lldb-command:run
27
28 // lldb-command:print self
29 // lldbg-check:[...]$0 = 1111
30 // lldbr-check:(isize) self = 1111
31 // lldb-command:continue
32
33 // lldb-command:print self
34 // lldbg-check:[...]$1 = { x = 2222 y = 3333 }
35 // lldbr-check:(by_value_self_argument_in_trait_impl::Struct) self = { x = 2222 y = 3333 }
36 // lldb-command:continue
37
38 // lldb-command:print self
39 // lldbg-check:[...] $2 = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 }
40 // lldbr-check:((f64, isize, isize, f64)) self = { 0 = 4444.5 1 = 5555 2 = 6666 3 = 7777.5 }
41 // lldb-command:continue
42
43 #![feature(omit_gdb_pretty_printer_section)]
44 #![omit_gdb_pretty_printer_section]
45
46 trait Trait {
47     fn method(self) -> Self;
48 }
49
50 impl Trait for isize {
51     fn method(self) -> isize {
52         zzz(); // #break
53         self
54     }
55 }
56
57 struct Struct {
58     x: usize,
59     y: usize,
60 }
61
62 impl Trait for Struct {
63     fn method(self) -> Struct {
64         zzz(); // #break
65         self
66     }
67 }
68
69 impl Trait for (f64, isize, isize, f64) {
70     fn method(self) -> (f64, isize, isize, f64) {
71         zzz(); // #break
72         self
73     }
74 }
75
76 fn main() {
77     let _ = (1111 as isize).method();
78     let _ = Struct { x: 2222, y: 3333 }.method();
79     let _ = (4444.5, 5555, 6666, 7777.5).method();
80 }
81
82 fn zzz() { () }