We can have a case where the placeholder is not configred and the
can_resolve check is not detecting this case which can lead to ICE.
gcc/rust/ChangeLog:
* typecheck/rust-tyty.cc (PlaceholderType::can_resolve): check for empty mappings
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
PlaceholderType::can_resolve () const
{
auto context = Resolver::TypeCheckContext::get ();
- return context->lookup_associated_type_mapping (get_ty_ref (), nullptr);
+
+ BaseType *lookup = nullptr;
+ HirId mapping;
+
+ if (!context->lookup_associated_type_mapping (get_ty_ref (), &mapping))
+ return false;
+
+ if (!context->lookup_type (mapping, &lookup))
+ return false;
+
+ return lookup != nullptr;
}
BaseType *