diff options
author | Philip Herron <philip.herron@embecosm.com> | 2021-09-17 17:35:09 +0100 |
---|---|---|
committer | Philip Herron <philip.herron@embecosm.com> | 2021-09-17 17:35:09 +0100 |
commit | aa019b251e9900e81e8b3ec258a4f1f340a91296 (patch) | |
tree | f583cecbc5729404572365295ca05628f2ddaf67 | |
parent | d9a0a5f864b69c68d410a14e0aa7ccbaae7eb144 (diff) | |
download | gcc-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.h | 3 |
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; |