Skip to content

Commit 6fcf482

Browse files
committed
Auto merge of #2337 - RalfJung:rustup, r=RalfJung
rustup Adds a regression test for rust-lang/rust#96185
2 parents 1118d94 + de2915b commit 6fcf482

File tree

2 files changed

+14
-1
lines changed

2 files changed

+14
-1
lines changed

rust-version

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
41ad4d9b2dbb895666337d162eda52619a6056db
1+
f342bea9d19f14616c6559312552e6d0ee529cfd

tests/pass/enums.rs

+13
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,18 @@ fn more_discriminant_overflow() {
119119
}
120120
}
121121

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+
122134
fn main() {
123135
test(MyEnum::MyEmptyVariant);
124136
test(MyEnum::MyNewtypeVariant(42));
@@ -127,4 +139,5 @@ fn main() {
127139

128140
discriminant_overflow();
129141
more_discriminant_overflow();
142+
overaligned_casts();
130143
}

0 commit comments

Comments
 (0)