aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-compile-context.h
diff options
context:
space:
mode:
authorMarc Poulhiès <dkm@kataplop.net>2021-03-08 21:13:02 +0100
committerPhilip Herron <herron.philip@googlemail.com>2021-03-27 18:03:34 +0000
commitfabb3894d5fe5c2ca87917fd08b2f0813553532d (patch)
treec31d037df544c9dbd3adaa1f904ce38620037d3b /gcc/rust/backend/rust-compile-context.h
parentf9f1f1d7211e555ae7a22b21723ced7610fa5657 (diff)
downloadgcc-fabb3894d5fe5c2ca87917fd08b2f0813553532d.zip
gcc-fabb3894d5fe5c2ca87917fd08b2f0813553532d.tar.gz
gcc-fabb3894d5fe5c2ca87917fd08b2f0813553532d.tar.bz2
WIP for #252
Removed TyTy::UnitType and TyTy::TypeKind::UNIT. Replaced by TyTy::TupleType with an empty list of fields. Added default empty vector for fields in ctor for TyTy::TypeType.
Diffstat (limited to 'gcc/rust/backend/rust-compile-context.h')
-rw-r--r--gcc/rust/backend/rust-compile-context.h11
1 files changed, 6 insertions, 5 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h
index 6f45e57..6347464 100644
--- a/gcc/rust/backend/rust-compile-context.h
+++ b/gcc/rust/backend/rust-compile-context.h
@@ -351,11 +351,6 @@ public:
ctx->get_mappings ()->lookup_location (type.get_ref ()));
}
- void visit (TyTy::UnitType &) override
- {
- translated = ctx->get_backend ()->void_type ();
- }
-
void visit (TyTy::ADTType &type) override
{
if (ctx->lookup_compiled_types (type.get_ty_ref (), &translated, &type))
@@ -389,6 +384,12 @@ public:
void visit (TyTy::TupleType &type) override
{
+ if (type.num_fields () == 0)
+ {
+ translated = ctx->get_backend ()->void_type ();
+ return;
+ }
+
bool ok = ctx->lookup_compiled_types (type.get_ty_ref (), &translated);
if (ok)
return;