From: Philip Herron <[email protected]>
Fixes Rust-GCC/gccrs#4814
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::do_typepathfunction): add guard
Signed-off-by: Philip Herron <[email protected]>
---
gcc/rust/hir/rust-hir-dump.cc | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc
index f21522b4d48..e1c2cfa8e43 100644
--- a/gcc/rust/hir/rust-hir-dump.cc
+++ b/gcc/rust/hir/rust-hir-dump.cc
@@ -406,7 +406,8 @@ void
Dump::do_typepathfunction (TypePathFunction &e)
{
visit_collection ("params", e.get_params ());
- visit_field ("return_type", e.get_return_type ());
+ if (e.has_return_type ())
+ visit_field ("return_type", e.get_return_type ());
}
void
--
2.50.1