We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8f867c5 commit 2a1a718Copy full SHA for 2a1a718
src/test/ui/consts/const-enum-cast.rs
@@ -4,6 +4,19 @@
4
enum A { A1, A2 }
5
enum B { B1=4, B2=2 }
6
7
+#[allow(dead_code)]
8
+#[repr(align(8))]
9
+enum Aligned {
10
+ Zero = 0,
11
+ One = 1,
12
+}
13
+
14
+// regression test for https://github.com/rust-lang/rust/issues/96185
15
+const X: u8 = {
16
+ let aligned = Aligned::Zero;
17
+ aligned as u8
18
+};
19
20
pub fn main () {
21
static c1: isize = A::A2 as isize;
22
static c2: isize = B::B2 as isize;
@@ -23,4 +36,6 @@ pub fn main () {
23
36
assert_eq!(c2_2, 4);
24
37
assert_eq!(a1_2, 0);
25
38
assert_eq!(a2_2, 4);
39
40
+ assert_eq!(X, 0);
26
41
}
0 commit comments