From 3c706cb54ba8094c6b14b1f95b27d504fe72a001 Mon Sep 17 00:00:00 2001 From: Nadrieril Date: Tue, 3 Sep 2024 17:28:00 +0200 Subject: [PATCH] Support unions --- frontend/exporter/src/types/mir.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/exporter/src/types/mir.rs b/frontend/exporter/src/types/mir.rs index 3b084ca4a..812f2bea9 100644 --- a/frontend/exporter/src/types/mir.rs +++ b/frontend/exporter/src/types/mir.rs @@ -713,7 +713,8 @@ impl<'tcx, S: UnderOwnerState<'tcx> + HasMir<'tcx>> SInto ProjectionElem::Field(match cur_ty.kind() { TyKind::Adt(adt_def, _) => { assert!( - (adt_def.is_struct() && variant_idx.is_none()) + ((adt_def.is_struct() || adt_def.is_union()) + && variant_idx.is_none()) || (adt_def.is_enum() && variant_idx.is_some()) ); ProjectionElemFieldKind::Adt {