aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-context.h
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
-rw-r--r--gcc/rust/backend/rust-compile-context.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h
index 2b2018f..551e041 100644
--- a/gcc/rust/backend/rust-compile-context.h
+++ b/gcc/rust/backend/rust-compile-context.h
@@ -431,10 +431,15 @@ public:
if (ctx->lookup_compiled_types (type.get_ty_ref (), &translated, &type))
return;
+ // we dont support enums yet
+ rust_assert (!type.is_enum ());
+ rust_assert (type.number_of_variants () == 1);
+
+ TyTy::VariantDef &variant = *type.get_variants ().at (0);
std::vector<Backend::Btyped_identifier> fields;
- for (size_t i = 0; i < type.num_fields (); i++)
+ for (size_t i = 0; i < variant.num_fields (); i++)
{
- const TyTy::StructFieldType *field = type.get_field (i);
+ const TyTy::StructFieldType *field = variant.get_field_at_index (i);
Btype *compiled_field_ty
= TyTyResolveCompile::compile (ctx, field->get_field_type ());