blob: 19f8398f1a94b594918ba41b06def6bc7a1f0287 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
|
// Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
// file at the top-level directory of this distribution and at
// http://rust-lang.org/COPYRIGHT.
//
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
// option. This file may not be copied, modified, or distributed
// except according to those terms.
// ignore-win32: FIXME #13256
// ignore-android: FIXME(#10381)
// compile-flags:-g
// gdb-command:rbreak zzz
// gdb-command:print 'c-style-enum::SINGLE_VARIANT'
// gdb-check:$1 = TheOnlyVariant
// gdb-command:print 'c-style-enum::AUTO_ONE'
// gdb-check:$2 = One
// gdb-command:print 'c-style-enum::AUTO_TWO'
// gdb-check:$3 = One
// gdb-command:print 'c-style-enum::AUTO_THREE'
// gdb-check:$4 = One
// gdb-command:print 'c-style-enum::MANUAL_ONE'
// gdb-check:$5 = OneHundred
// gdb-command:print 'c-style-enum::MANUAL_TWO'
// gdb-check:$6 = OneHundred
// gdb-command:print 'c-style-enum::MANUAL_THREE'
// gdb-check:$7 = OneHundred
// gdb-command:run
// gdb-command:finish
// gdb-command:print auto_one
// gdb-check:$8 = One
// gdb-command:print auto_two
// gdb-check:$9 = Two
// gdb-command:print auto_three
// gdb-check:$10 = Three
// gdb-command:print manual_one_hundred
// gdb-check:$11 = OneHundred
// gdb-command:print manual_one_thousand
// gdb-check:$12 = OneThousand
// gdb-command:print manual_one_million
// gdb-check:$13 = OneMillion
// gdb-command:print single_variant
// gdb-check:$14 = TheOnlyVariant
// gdb-command:print 'c-style-enum::AUTO_TWO'
// gdb-check:$15 = Two
// gdb-command:print 'c-style-enum::AUTO_THREE'
// gdb-check:$16 = Three
// gdb-command:print 'c-style-enum::MANUAL_TWO'
// gdb-check:$17 = OneThousand
// gdb-command:print 'c-style-enum::MANUAL_THREE'
// gdb-check:$18 = OneMillion
#![allow(unused_variable)]
#![allow(dead_code)]
enum AutoDiscriminant {
One,
Two,
Three
}
enum ManualDiscriminant {
OneHundred = 100,
OneThousand = 1000,
OneMillion = 1000000
}
enum SingleVariant {
TheOnlyVariant
}
static SINGLE_VARIANT: SingleVariant = TheOnlyVariant;
static mut AUTO_ONE: AutoDiscriminant = One;
static mut AUTO_TWO: AutoDiscriminant = One;
static mut AUTO_THREE: AutoDiscriminant = One;
static mut MANUAL_ONE: ManualDiscriminant = OneHundred;
static mut MANUAL_TWO: ManualDiscriminant = OneHundred;
static mut MANUAL_THREE: ManualDiscriminant = OneHundred;
fn main() {
let auto_one = One;
let auto_two = Two;
let auto_three = Three;
let manual_one_hundred = OneHundred;
let manual_one_thousand = OneThousand;
let manual_one_million = OneMillion;
let single_variant = TheOnlyVariant;
unsafe {
AUTO_TWO = Two;
AUTO_THREE = Three;
MANUAL_TWO = OneThousand;
MANUAL_THREE = OneMillion;
};
zzz();
let a = SINGLE_VARIANT;
let a = unsafe { AUTO_ONE };
let a = unsafe { MANUAL_ONE };
}
fn zzz() {()}
|