Enumerations: how are they stored and other questions

Pick an ABI that doesn't rely on inhabitedness. For ! specifically, that would be:

  • Any two types with size 0 and alignment 1 are ABI-compatible.

(I'm not aware of any specific guarantees for uninhabited types that don't meet those requirements, but the compiler just needs to be consistent.)

I think the motivation for MaybeUninit explains this better than I could summarize.

The alternatives tend to not play great with the type system (magic one-off functions, post-mono errors, new auto-traits that potentially also infect and break existing code, ...). There's a lot more conversation about those in the PR thread too.