]> git.lizzy.rs Git - rust.git/blob - src/test/debuginfo/c-style-enum.rs
Auto merge of #28816 - petrochenkov:unistruct, r=nrc
[rust.git] / src / test / debuginfo / c-style-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 // ignore-aarch64
12 // min-lldb-version: 310
13
14 // compile-flags:-g
15
16 // === GDB TESTS ===================================================================================
17
18 // gdb-command:print 'c_style_enum::SINGLE_VARIANT'
19 // gdb-check:$1 = TheOnlyVariant
20
21 // gdb-command:print 'c_style_enum::AUTO_ONE'
22 // gdb-check:$2 = One
23
24 // gdb-command:print 'c_style_enum::AUTO_TWO'
25 // gdb-check:$3 = One
26
27 // gdb-command:print 'c_style_enum::AUTO_THREE'
28 // gdb-check:$4 = One
29
30 // gdb-command:print 'c_style_enum::MANUAL_ONE'
31 // gdb-check:$5 = OneHundred
32
33 // gdb-command:print 'c_style_enum::MANUAL_TWO'
34 // gdb-check:$6 = OneHundred
35
36 // gdb-command:print 'c_style_enum::MANUAL_THREE'
37 // gdb-check:$7 = OneHundred
38
39 // gdb-command:run
40
41 // gdb-command:print auto_one
42 // gdb-check:$8 = One
43
44 // gdb-command:print auto_two
45 // gdb-check:$9 = Two
46
47 // gdb-command:print auto_three
48 // gdb-check:$10 = Three
49
50 // gdb-command:print manual_one_hundred
51 // gdb-check:$11 = OneHundred
52
53 // gdb-command:print manual_one_thousand
54 // gdb-check:$12 = OneThousand
55
56 // gdb-command:print manual_one_million
57 // gdb-check:$13 = OneMillion
58
59 // gdb-command:print single_variant
60 // gdb-check:$14 = TheOnlyVariant
61
62 // gdb-command:print 'c_style_enum::AUTO_TWO'
63 // gdb-check:$15 = Two
64
65 // gdb-command:print 'c_style_enum::AUTO_THREE'
66 // gdb-check:$16 = Three
67
68 // gdb-command:print 'c_style_enum::MANUAL_TWO'
69 // gdb-check:$17 = OneThousand
70
71 // gdb-command:print 'c_style_enum::MANUAL_THREE'
72 // gdb-check:$18 = OneMillion
73
74
75 // === LLDB TESTS ==================================================================================
76
77 // lldb-command:run
78
79 // lldb-command:print auto_one
80 // lldb-check:[...]$0 = One
81
82 // lldb-command:print auto_two
83 // lldb-check:[...]$1 = Two
84
85 // lldb-command:print auto_three
86 // lldb-check:[...]$2 = Three
87
88 // lldb-command:print manual_one_hundred
89 // lldb-check:[...]$3 = OneHundred
90
91 // lldb-command:print manual_one_thousand
92 // lldb-check:[...]$4 = OneThousand
93
94 // lldb-command:print manual_one_million
95 // lldb-check:[...]$5 = OneMillion
96
97 // lldb-command:print single_variant
98 // lldb-check:[...]$6 = TheOnlyVariant
99
100 #![allow(unused_variables)]
101 #![allow(dead_code)]
102 #![feature(omit_gdb_pretty_printer_section)]
103 #![omit_gdb_pretty_printer_section]
104
105 use self::AutoDiscriminant::{One, Two, Three};
106 use self::ManualDiscriminant::{OneHundred, OneThousand, OneMillion};
107 use self::SingleVariant::TheOnlyVariant;
108
109 #[derive(Copy, Clone)]
110 enum AutoDiscriminant {
111     One,
112     Two,
113     Three
114 }
115
116 #[derive(Copy, Clone)]
117 enum ManualDiscriminant {
118     OneHundred = 100,
119     OneThousand = 1000,
120     OneMillion = 1000000
121 }
122
123 #[derive(Copy, Clone)]
124 enum SingleVariant {
125     TheOnlyVariant
126 }
127
128 static SINGLE_VARIANT: SingleVariant = TheOnlyVariant;
129
130 static mut AUTO_ONE: AutoDiscriminant = One;
131 static mut AUTO_TWO: AutoDiscriminant = One;
132 static mut AUTO_THREE: AutoDiscriminant = One;
133
134 static mut MANUAL_ONE: ManualDiscriminant = OneHundred;
135 static mut MANUAL_TWO: ManualDiscriminant = OneHundred;
136 static mut MANUAL_THREE: ManualDiscriminant = OneHundred;
137
138 fn main() {
139
140     let auto_one = One;
141     let auto_two = Two;
142     let auto_three = Three;
143
144     let manual_one_hundred = OneHundred;
145     let manual_one_thousand = OneThousand;
146     let manual_one_million = OneMillion;
147
148     let single_variant = TheOnlyVariant;
149
150     unsafe {
151         AUTO_TWO = Two;
152         AUTO_THREE = Three;
153
154         MANUAL_TWO = OneThousand;
155         MANUAL_THREE = OneMillion;
156     };
157
158     zzz(); // #break
159
160     let a = SINGLE_VARIANT;
161     let a = unsafe { AUTO_ONE };
162     let a = unsafe { MANUAL_ONE };
163 }
164
165 fn zzz() { () }