From aa81cba491eef0c17ba03fa7f7d003b0139a5c1a Mon Sep 17 00:00:00 2001 From: Ellen Arteca Date: Fri, 15 Nov 2024 16:34:44 -0800 Subject: [PATCH] throw error if enum variant has a field --- core/src/ast/enums.rs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/src/ast/enums.rs b/core/src/ast/enums.rs index 766833277..3169b6331 100644 --- a/core/src/ast/enums.rs +++ b/core/src/ast/enums.rs @@ -39,6 +39,9 @@ impl Enum { .variants .iter() .map(|v| { + if !matches!(v.fields, syn::Fields::Unit) { + panic!("Enums cannot have fields, we only support C-like enums"); + } let new_discriminant = v .discriminant .as_ref()