diff options
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
-rw-r--r-- | gcc/rust/backend/rust-compile-context.h | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h index 0aaf084..8007c2f 100644 --- a/gcc/rust/backend/rust-compile-context.h +++ b/gcc/rust/backend/rust-compile-context.h @@ -417,9 +417,13 @@ public: fields.push_back (std::move (f)); } - Btype *struct_type_record = ctx->get_backend ()->struct_type (fields); + Btype *type_record; + if (type.is_union ()) + type_record = ctx->get_backend ()->union_type (fields); + else + type_record = ctx->get_backend ()->struct_type (fields); Btype *named_struct - = ctx->get_backend ()->named_type (type.get_name (), struct_type_record, + = ctx->get_backend ()->named_type (type.get_name (), type_record, ctx->get_mappings ()->lookup_location ( type.get_ty_ref ())); |