aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gcc/rust/backend/rust-compile-expr.h6
-rw-r--r--gcc/rust/hir/rust-ast-lower-type.h8
-rw-r--r--gcc/rust/hir/tree/rust-hir-full-test.cc5
-rw-r--r--gcc/rust/typecheck/rust-hir-type-check-type.h10
4 files changed, 17 insertions, 12 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.h b/gcc/rust/backend/rust-compile-expr.h
index 59ae815..09652f1 100644
--- a/gcc/rust/backend/rust-compile-expr.h
+++ b/gcc/rust/backend/rust-compile-expr.h
@@ -183,8 +183,10 @@ public:
if (!ctx->get_tyctx ()->lookup_type (
expr.get_mappings ().get_hirid (), &tyty))
{
- rust_fatal_error (expr.get_locus (),
- "did not resolve type for this literal expr");
+ rust_fatal_error (
+ expr.get_locus (),
+ "did not resolve type for this literal expr (HirId %d)",
+ expr.get_mappings ().get_hirid ());
return;
}
diff --git a/gcc/rust/hir/rust-ast-lower-type.h b/gcc/rust/hir/rust-ast-lower-type.h
index 86e802e..5e19850 100644
--- a/gcc/rust/hir/rust-ast-lower-type.h
+++ b/gcc/rust/hir/rust-ast-lower-type.h
@@ -72,15 +72,15 @@ public:
});
auto crate_num = mappings->get_current_crate ();
- Analysis::NodeMapping mapping (crate_num, path.get_node_id (),
- mappings->get_next_hir_id (crate_num),
+ auto hirid = mappings->get_next_hir_id (crate_num);
+ Analysis::NodeMapping mapping (crate_num, path.get_node_id (), hirid,
mappings->get_next_localdef_id (crate_num));
+
translated
= new HIR::TypePath (std::move (mapping), std::move (translated_segments),
path.get_locus (),
path.has_opening_scope_resolution_op ());
- mappings->insert_hir_type (mapping.get_crate_num (), mapping.get_hirid (),
- translated);
+ mappings->insert_hir_type (crate_num, hirid, translated);
}
private:
diff --git a/gcc/rust/hir/tree/rust-hir-full-test.cc b/gcc/rust/hir/tree/rust-hir-full-test.cc
index 14b64d2..236ff3d 100644
--- a/gcc/rust/hir/tree/rust-hir-full-test.cc
+++ b/gcc/rust/hir/tree/rust-hir-full-test.cc
@@ -577,11 +577,12 @@ StructStruct::as_string () const
{
for (const auto &field : fields)
{
- str += "\n " + field.as_string ();
+ str += "\n - " + field.as_string ();
}
+ str += "\n";
}
- return str;
+ return str + "::" + get_mappings ().as_string () + "\n";
}
std::string
diff --git a/gcc/rust/typecheck/rust-hir-type-check-type.h b/gcc/rust/typecheck/rust-hir-type-check-type.h
index 70b9cfa..136c0c2 100644
--- a/gcc/rust/typecheck/rust-hir-type-check-type.h
+++ b/gcc/rust/typecheck/rust-hir-type-check-type.h
@@ -118,18 +118,20 @@ public:
{
// lookup the Node this resolves to
NodeId ref;
- if (!resolver->lookup_resolved_type (path.get_mappings ().get_nodeid (),
- &ref))
+ auto nid = path.get_mappings ().get_nodeid ();
+ if (!resolver->lookup_resolved_type (nid, &ref))
{
rust_fatal_error (path.get_locus (),
- "Failed to resolve node id to HIR");
+ "failed to resolve node '%d' to HIR", nid);
return;
}
HirId hir_lookup;
if (!context->lookup_type_by_node_id (ref, &hir_lookup))
{
- rust_error_at (path.get_locus (), "failed to lookup HIR node");
+ rust_error_at (path.get_locus (),
+ "failed to lookup HIR %d for node '%s'", ref,
+ path.as_string ().c_str ());
return;
}