aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend/rust-mangle-v0.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/backend/rust-mangle-v0.cc')
-rw-r--r--gcc/rust/backend/rust-mangle-v0.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/gcc/rust/backend/rust-mangle-v0.cc b/gcc/rust/backend/rust-mangle-v0.cc
index 0c85d42..b2f11b1 100644
--- a/gcc/rust/backend/rust-mangle-v0.cc
+++ b/gcc/rust/backend/rust-mangle-v0.cc
@@ -374,14 +374,15 @@ v0_path (Rust::Compile::Context *ctx, const TyTy::BaseType *ty,
V0Path v0path = {};
cpath.iterate_segs ([&] (const Resolver::CanonicalPath &seg) {
- HirId hir_id;
- bool ok = mappings.lookup_node_to_hir (seg.get_node_id (), &hir_id);
- if (!ok)
+ tl::optional<HirId> hid = mappings.lookup_node_to_hir (seg.get_node_id ());
+ if (!hid.has_value ())
{
// FIXME: generic arg in canonical path? (e.g. <i32> in crate::S<i32>)
rust_unreachable ();
}
+ auto hir_id = hid.value ();
+
HirId parent_impl_id = UNKNOWN_HIRID;
HIR::ImplItem *impl_item
= mappings.lookup_hir_implitem (hir_id, &parent_impl_id);