aboutsummaryrefslogtreecommitdiff
path: root/gcc/rust/backend
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/rust/backend')
-rw-r--r--gcc/rust/backend/rust-compile-expr.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/gcc/rust/backend/rust-compile-expr.cc b/gcc/rust/backend/rust-compile-expr.cc
index 28b901e..e2fa6dd 100644
--- a/gcc/rust/backend/rust-compile-expr.cc
+++ b/gcc/rust/backend/rust-compile-expr.cc
@@ -2216,10 +2216,12 @@ CompileExpr::generate_closure_function (HIR::ClosureExpr &expr,
const Resolver::CanonicalPath &parent_canonical_path
= closure_tyty.get_ident ().path;
- NodeId node_id;
- bool ok = ctx->get_mappings ().lookup_hir_to_node (
- expr.get_mappings ().get_hirid (), &node_id);
- rust_assert (ok);
+
+ tl::optional<NodeId> nid = ctx->get_mappings ().lookup_hir_to_node (
+ expr.get_mappings ().get_hirid ());
+ rust_assert (nid.has_value ());
+ auto node_id = nid.value ();
+
Resolver::CanonicalPath path = parent_canonical_path.append (
Resolver::CanonicalPath::new_seg (node_id, "{{closure}}"));