make no-variant types a dedicated Variants variant

This commit is contained in:
Ralf Jung
2024-12-01 17:33:01 +01:00
parent 21de42bf8d
commit e023590de4
53 changed files with 246 additions and 495 deletions

View File

@@ -206,7 +206,7 @@ impl<'a, Ty> TyAndLayout<'a, Ty> {
let (mut result, mut total) = from_fields_at(*self, Size::ZERO)?;
match &self.variants {
abi::Variants::Single { .. } => {}
abi::Variants::Single { .. } | abi::Variants::Empty => {}
abi::Variants::Multiple { variants, .. } => {
// Treat enum variants like union members.
// HACK(eddyb) pretend the `enum` field (discriminant)