What is the reason Rustc doesn't store discriminants in structs where possible?
What I mean is:
\tstruct Foo {
\t a: i8,
\t b: i16,
\t}
\tfn main() {
\t println!("{}", std::mem::size_of::<Option<Foo>>());
\t}
This code outputs 6 rather than 4. I had expected that the system would store the discriminant inside of the struct here and that we would effectively have:
#[repr(C)]
\tstruct Option_Foo {
\t a: i8,
discriminant: i8
\t b: i16,
\t}
As it monomorphizes types and functions to work with it. I know the system does use the null pointer value for discriminants for anything containing a NonNull<_> so what's the reason it does not do this?