aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-09-17 17:35:09 +0100
committerPhilip Herron <philip.herron@embecosm.com>2021-09-17 17:35:09 +0100
commitaa019b251e9900e81e8b3ec258a4f1f340a91296 (patch)
treef583cecbc5729404572365295ca05628f2ddaf67
parentd9a0a5f864b69c68d410a14e0aa7ccbaae7eb144 (diff)
downloadgcc-aa019b251e9900e81e8b3ec258a4f1f340a91296.zip
gcc-aa019b251e9900e81e8b3ec258a4f1f340a91296.tar.gz
gcc-aa019b251e9900e81e8b3ec258a4f1f340a91296.tar.bz2
Default to TyTy::Error node on TypePath resolution failure
We should insert the error node into the type context when we have a type error such that covariant types using TyVar can still work, and avoid the assertion to ensure something exists within the context for that id upon creation.
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-type.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.h b/gcc/rust/typecheck/rust-hir-type-check-type.h
index 1f97a4e..eb1c861 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-type.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-type.h
@@ -66,7 +66,8 @@ public:
type->accept_vis (resolver);
if (resolver.translated == nullptr)
- return new TyTy::ErrorType (type->get_mappings ().get_hirid ());
+ resolver.translated
+ = new TyTy::ErrorType (type->get_mappings ().get_hirid ());
resolver.context->insert_type (type->get_mappings (), resolver.translated);
return resolver.translated;