diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc index 03c09021e457..a6a880121a1d 100644 --- a/gcc/rust/hir/rust-hir-dump.cc +++ b/gcc/rust/hir/rust-hir-dump.cc @@ -1365,7 +1365,8 @@ Dump::visit (ReturnExpr &e) begin ("ReturnExpr"); do_mappings (e.get_mappings ()); - visit_field ("return_expr", e.get_expr ()); + if (e.has_return_expr ()) + visit_field ("return_expr", e.get_expr ()); end ("ReturnExpr"); }