aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorPhilip Herron <philip.herron@embecosm.com>2021-11-05 10:44:40 +0000
committerPhilip Herron <philip.herron@embecosm.com>2021-11-05 11:12:50 +0000
commitdfba45d0cd111d2569a98b4e3a39069414ec7636 (patch)
treec711d84c33073aaf20a1cabe8c597a1c46fb2efd /gcc
parent57acd1e20828fabe9cfe3b741680f06a1f21251e (diff)
downloadgcc-dfba45d0cd111d2569a98b4e3a39069414ec7636.zip
gcc-dfba45d0cd111d2569a98b4e3a39069414ec7636.tar.gz
gcc-dfba45d0cd111d2569a98b4e3a39069414ec7636.tar.bz2
When we are resolving TypePaths default the result to ErrorType
Diffstat (limited to 'gcc')
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-type.h14
1 files changed, 6 insertions, 8 deletions
diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.h b/gcc/rust/typecheck/rust-hir-type-check-type.h
index 1f7f71d..08734ce 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-type.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-type.h
@@ -62,13 +62,9 @@ public:
std::vector<TyTy::SubstitutionParamMapping> *subst_mappings
= nullptr)
{
- TypeCheckType resolver (subst_mappings);
+ TypeCheckType resolver (type->get_mappings ().get_hirid (), subst_mappings);
type->accept_vis (resolver);
-
- if (resolver.translated == nullptr)
- resolver.translated
- = new TyTy::ErrorType (type->get_mappings ().get_hirid ());
-
+ rust_assert (resolver.translated != nullptr);
resolver.context->insert_type (type->get_mappings (), resolver.translated);
return resolver.translated;
}
@@ -150,8 +146,10 @@ public:
void visit (HIR::TraitObjectType &type) override;
private:
- TypeCheckType (std::vector<TyTy::SubstitutionParamMapping> *subst_mappings)
- : TypeCheckBase (), subst_mappings (subst_mappings), translated (nullptr)
+ TypeCheckType (HirId id,
+ std::vector<TyTy::SubstitutionParamMapping> *subst_mappings)
+ : TypeCheckBase (), subst_mappings (subst_mappings),
+ translated (new TyTy::ErrorType (id))
{}
void