aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-01-08 15:12:19 +0000
committerPhilip Herron <herron.philip@googlemail.com>2021-01-09 14:46:32 +0000
commit5a11dd79fcbcfc8b3fcd41f809c7fa373d637e41 (patch)
treeb99c4ea138b3c5355f2782ab4e6c93082069d0d2 /gcc/rust/backend
parent06d946d52234e2776be002662439d43e3d557673 (diff)
downloadgcc-5a11dd79fcbcfc8b3fcd41f809c7fa373d637e41.zip
gcc-5a11dd79fcbcfc8b3fcd41f809c7fa373d637e41.tar.gz
gcc-5a11dd79fcbcfc8b3fcd41f809c7fa373d637e41.tar.bz2
Make TyTyVisitor a pure abstract class
This will help enforce consistency of visitors to fix issues with TyTy unification rules.
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-context.h6
-rw-r--r--gcc/rust/backend/rust-compile-tyty.h56
2 files changed, 54 insertions, 8 deletions
diff --git a/gcc/rust/backend/rust-compile-context.h b/gcc/rust/backend/rust-compile-context.h
index d241921..298ff50 100644
--- a/gcc/rust/backend/rust-compile-context.h
+++ b/gcc/rust/backend/rust-compile-context.h
@@ -221,12 +221,18 @@ public:
virtual ~TyTyResolveCompile () {}
+ void visit (TyTy::ErrorType &type) override { gcc_unreachable (); }
+
void visit (TyTy::UnitType &type) override { gcc_unreachable (); }
void visit (TyTy::InferType &type) override { gcc_unreachable (); }
void visit (TyTy::FnType &type) override { gcc_unreachable (); }
+ void visit (TyTy::StructFieldType &type) override { gcc_unreachable (); }
+
+ void visit (TyTy::ParamType &type) override { gcc_unreachable (); }
+
void visit (TyTy::ADTType &type) override
{
::Btype *compiled_type = nullptr;
diff --git a/gcc/rust/backend/rust-compile-tyty.h b/gcc/rust/backend/rust-compile-tyty.h
index 2d4e1f0..137b74b 100644
--- a/gcc/rust/backend/rust-compile-tyty.h
+++ b/gcc/rust/backend/rust-compile-tyty.h
@@ -43,13 +43,19 @@ public:
~TyTyCompile () {}
- void visit (TyTy::InferType &type) override
- {
- // there shouldn't be any of these left
- gcc_unreachable ();
- }
+ void visit (TyTy::ErrorType &type) override { gcc_unreachable (); }
+
+ void visit (TyTy::UnitType &type) override { gcc_unreachable (); }
+
+ void visit (TyTy::InferType &type) override { gcc_unreachable (); }
+
+ void visit (TyTy::StructFieldType &type) override { gcc_unreachable (); }
- void visit (TyTy::UnitType &type) override {}
+ void visit (TyTy::ParamType &type) override { gcc_unreachable (); }
+
+ void visit (TyTy::ADTType &type) override { gcc_unreachable (); }
+
+ void visit (TyTy::ArrayType &type) override { gcc_unreachable (); }
void visit (TyTy::FnType &type) override
{
@@ -82,8 +88,6 @@ public:
mappings->lookup_location (type.get_ref ()));
}
- void visit (TyTy::ParamType &type) override {}
-
void visit (TyTy::BoolType &type) override
{
translated = backend->named_type ("bool", backend->bool_type (),
@@ -205,6 +209,18 @@ public:
~TyTyExtractParamsFromFnType () {}
+ void visit (TyTy::UnitType &type) override { gcc_unreachable (); }
+ void visit (TyTy::InferType &type) override { gcc_unreachable (); }
+ void visit (TyTy::StructFieldType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ADTType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ParamType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ArrayType &type) override { gcc_unreachable (); }
+ void visit (TyTy::BoolType &type) override { gcc_unreachable (); }
+ void visit (TyTy::IntType &type) override { gcc_unreachable (); }
+ void visit (TyTy::UintType &type) override { gcc_unreachable (); }
+ void visit (TyTy::FloatType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ErrorType &type) override { gcc_unreachable (); }
+
void visit (TyTy::FnType &type) override
{
ok = true;
@@ -234,6 +250,18 @@ public:
~TyTyExtractRetFromFnType () {}
+ void visit (TyTy::UnitType &type) override { gcc_unreachable (); }
+ void visit (TyTy::InferType &type) override { gcc_unreachable (); }
+ void visit (TyTy::StructFieldType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ADTType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ParamType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ArrayType &type) override { gcc_unreachable (); }
+ void visit (TyTy::BoolType &type) override { gcc_unreachable (); }
+ void visit (TyTy::IntType &type) override { gcc_unreachable (); }
+ void visit (TyTy::UintType &type) override { gcc_unreachable (); }
+ void visit (TyTy::FloatType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ErrorType &type) override { gcc_unreachable (); }
+
void visit (TyTy::FnType &type) override
{
ok = true;
@@ -261,6 +289,18 @@ public:
~TyTyCompileParam () {}
+ void visit (TyTy::UnitType &type) override { gcc_unreachable (); }
+ void visit (TyTy::InferType &type) override { gcc_unreachable (); }
+ void visit (TyTy::StructFieldType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ADTType &type) override { gcc_unreachable (); }
+ void visit (TyTy::FnType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ArrayType &type) override { gcc_unreachable (); }
+ void visit (TyTy::BoolType &type) override { gcc_unreachable (); }
+ void visit (TyTy::IntType &type) override { gcc_unreachable (); }
+ void visit (TyTy::UintType &type) override { gcc_unreachable (); }
+ void visit (TyTy::FloatType &type) override { gcc_unreachable (); }
+ void visit (TyTy::ErrorType &type) override { gcc_unreachable (); }
+
void visit (TyTy::ParamType &type) override
{
auto btype = TyTyCompile::compile (backend, type.get_base_type ());