]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/method-on-enum.rs
Auto merge of #82552 - GuillaumeGomez:rollup-8dn1ztn, r=GuillaumeGomez
[rust.git] / src / test / debuginfo / method-on-enum.rs
1 // ignore-tidy-linelength
2 // min-lldb-version: 310
3 // ignore-test // Test temporarily ignored due to debuginfo tests being disabled, see PR 47155
4
5 // compile-flags:-g
6
7 // === GDB TESTS ===================================================================================
8
9 // gdb-command:run
10
11 // STACK BY REF
12 // gdb-command:print *self
13 // gdbg-check:$1 = {{RUST$ENUM$DISR = Variant2, [...]}, {RUST$ENUM$DISR = Variant2, __0 = 117901063}}
14 // gdbr-check:$1 = method_on_enum::Enum::Variant2(117901063)
15 // gdb-command:print arg1
16 // gdb-check:$2 = -1
17 // gdb-command:print arg2
18 // gdb-check:$3 = -2
19 // gdb-command:continue
20
21 // STACK BY VAL
22 // gdb-command:print self
23 // gdbg-check:$4 = {{RUST$ENUM$DISR = Variant2, [...]}, {RUST$ENUM$DISR = Variant2, __0 = 117901063}}
24 // gdbr-check:$4 = method_on_enum::Enum::Variant2(117901063)
25 // gdb-command:print arg1
26 // gdb-check:$5 = -3
27 // gdb-command:print arg2
28 // gdb-check:$6 = -4
29 // gdb-command:continue
30
31 // OWNED BY REF
32 // gdb-command:print *self
33 // gdbg-check:$7 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
34 // gdbr-check:$7 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
35 // gdb-command:print arg1
36 // gdb-check:$8 = -5
37 // gdb-command:print arg2
38 // gdb-check:$9 = -6
39 // gdb-command:continue
40
41 // OWNED BY VAL
42 // gdb-command:print self
43 // gdbg-check:$10 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
44 // gdbr-check:$10 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
45 // gdb-command:print arg1
46 // gdb-check:$11 = -7
47 // gdb-command:print arg2
48 // gdb-check:$12 = -8
49 // gdb-command:continue
50
51 // OWNED MOVED
52 // gdb-command:print *self
53 // gdbg-check:$13 = {{RUST$ENUM$DISR = Variant1, x = 1799, y = 1799}, {RUST$ENUM$DISR = Variant1, [...]}}
54 // gdbr-check:$13 = method_on_enum::Enum::Variant1{x: 1799, y: 1799}
55 // gdb-command:print arg1
56 // gdb-check:$14 = -9
57 // gdb-command:print arg2
58 // gdb-check:$15 = -10
59 // gdb-command:continue
60
61
62 // === LLDB TESTS ==================================================================================
63
64 // lldb-command:run
65
66 // STACK BY REF
67 // lldb-command:print *self
68 // lldb-check:[...]$0 = Variant2(117901063)
69 // lldb-command:print arg1
70 // lldb-check:[...]$1 = -1
71 // lldb-command:print arg2
72 // lldb-check:[...]$2 = -2
73 // lldb-command:continue
74
75 // STACK BY VAL
76 // lldb-command:print self
77 // lldb-check:[...]$3 = Variant2(117901063)
78 // lldb-command:print arg1
79 // lldb-check:[...]$4 = -3
80 // lldb-command:print arg2
81 // lldb-check:[...]$5 = -4
82 // lldb-command:continue
83
84 // OWNED BY REF
85 // lldb-command:print *self
86 // lldb-check:[...]$6 = Variant1 { x: 1799, y: 1799 }
87 // lldb-command:print arg1
88 // lldb-check:[...]$7 = -5
89 // lldb-command:print arg2
90 // lldb-check:[...]$8 = -6
91 // lldb-command:continue
92
93 // OWNED BY VAL
94 // lldb-command:print self
95 // lldb-check:[...]$9 = Variant1 { x: 1799, y: 1799 }
96 // lldb-command:print arg1
97 // lldb-check:[...]$10 = -7
98 // lldb-command:print arg2
99 // lldb-check:[...]$11 = -8
100 // lldb-command:continue
101
102 // OWNED MOVED
103 // lldb-command:print *self
104 // lldb-check:[...]$12 = Variant1 { x: 1799, y: 1799 }
105 // lldb-command:print arg1
106 // lldb-check:[...]$13 = -9
107 // lldb-command:print arg2
108 // lldb-check:[...]$14 = -10
109 // lldb-command:continue
110
111 #![feature(box_syntax)]
112 #![feature(omit_gdb_pretty_printer_section)]
113 #![omit_gdb_pretty_printer_section]
114
115 #[derive(Copy, Clone)]
116 enum Enum {
117     Variant1 { x: u16, y: u16 },
118     Variant2 (u32)
119 }
120
121 impl Enum {
122
123     fn self_by_ref(&self, arg1: isize, arg2: isize) -> isize {
124         zzz(); // #break
125         arg1 + arg2
126     }
127
128     fn self_by_val(self, arg1: isize, arg2: isize) -> isize {
129         zzz(); // #break
130         arg1 + arg2
131     }
132
133     fn self_owned(self: Box<Enum>, arg1: isize, arg2: isize) -> isize {
134         zzz(); // #break
135         arg1 + arg2
136     }
137 }
138
139 fn main() {
140     let stack = Enum::Variant2(117901063);
141     let _ = stack.self_by_ref(-1, -2);
142     let _ = stack.self_by_val(-3, -4);
143
144     let owned: Box<_> = box Enum::Variant1{ x: 1799, y: 1799 };
145     let _ = owned.self_by_ref(-5, -6);
146     let _ = owned.self_by_val(-7, -8);
147     let _ = owned.self_owned(-9, -10);
148 }
149
150 fn zzz() {()}