Open Jules-Bertholet opened 9 months ago
this optimization should apply when variants have data too:
// could be size 2 since A and B's discriminants are in the same spot with non-overlapping contiguous values, but currently isn't
enum Top {
A(A),
B(B),
}
#[repr(u8)]
enum A {
A0(u8) = 0,
A1(u8) = 1,
}
#[repr(u8)]
enum B {
B2(u8) = 2,
B3(u8) = 3,
}
I tried this code:
I expected to see this happen:
Choice
has size 1Instead, this happened:
Choice
has size 2Meta
Rust version; 1.74.1
@rustbot label A-layout T-compiler