]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/static-method-on-struct-and-enum.rs
Auto merge of #28816 - petrochenkov:unistruct, r=nrc
[rust.git] / src / test / debuginfo / static-method-on-struct-and-enum.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 // STRUCT
20 // gdb-command:print arg1
21 // gdb-check:$1 = 1
22 // gdb-command:print arg2
23 // gdb-check:$2 = 2
24 // gdb-command:continue
25
26 // ENUM
27 // gdb-command:print arg1
28 // gdb-check:$3 = -3
29 // gdb-command:print arg2
30 // gdb-check:$4 = 4.5
31 // gdb-command:print arg3
32 // gdb-check:$5 = 5
33 // gdb-command:continue
34
35
36 // === LLDB TESTS ==================================================================================
37
38 // lldb-command:run
39
40 // STRUCT
41 // lldb-command:print arg1
42 // lldb-check:[...]$0 = 1
43 // lldb-command:print arg2
44 // lldb-check:[...]$1 = 2
45 // lldb-command:continue
46
47 // ENUM
48 // lldb-command:print arg1
49 // lldb-check:[...]$2 = -3
50 // lldb-command:print arg2
51 // lldb-check:[...]$3 = 4.5
52 // lldb-command:print arg3
53 // lldb-check:[...]$4 = 5
54 // lldb-command:continue
55
56 #![feature(omit_gdb_pretty_printer_section)]
57 #![omit_gdb_pretty_printer_section]
58
59 struct Struct {
60     x: isize
61 }
62
63 impl Struct {
64
65     fn static_method(arg1: isize, arg2: isize) -> isize {
66         zzz(); // #break
67         arg1 + arg2
68     }
69 }
70
71 enum Enum {
72     Variant1 { x: isize },
73     Variant2,
74     Variant3(f64, isize, char),
75 }
76
77 impl Enum {
78
79     fn static_method(arg1: isize, arg2: f64, arg3: usize) -> isize {
80         zzz(); // #break
81         arg1
82     }
83 }
84
85 fn main() {
86     Struct::static_method(1, 2);
87     Enum::static_method(-3, 4.5, 5);
88 }
89
90 fn zzz() {()}