Skip to content

Commit

Permalink
throw error if enum variant has a field (#733)
Browse files Browse the repository at this point in the history
Co-authored-by: Ellen Arteca <[email protected]>
  • Loading branch information
emarteca and Ellen Arteca authored Nov 17, 2024
1 parent 4232380 commit ecd0c61
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions core/src/ast/enums.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit ecd0c61

Please sign in to comment.