We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 1118d94 + de2915b commit 6fcf482Copy full SHA for 6fcf482
rust-version
@@ -1 +1 @@
1
-41ad4d9b2dbb895666337d162eda52619a6056db
+f342bea9d19f14616c6559312552e6d0ee529cfd
tests/pass/enums.rs
@@ -119,6 +119,18 @@ fn more_discriminant_overflow() {
119
}
120
121
122
+fn overaligned_casts() {
123
+ #[allow(dead_code)]
124
+ #[repr(align(8))]
125
+ enum Aligned {
126
+ Zero = 0,
127
+ One = 1,
128
+ }
129
+
130
+ let aligned = Aligned::Zero;
131
+ assert_eq!(aligned as u8, 0);
132
+}
133
134
fn main() {
135
test(MyEnum::MyEmptyVariant);
136
test(MyEnum::MyNewtypeVariant(42));
@@ -127,4 +139,5 @@ fn main() {
139
140
discriminant_overflow();
141
more_discriminant_overflow();
142
+ overaligned_casts();
143
0 commit comments