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]>
---
This change was merged into the gccrs repository and is posted here for
upstream visibility and potential drive-by review, as requested by GCC
release managers.
Each commit email contains a link to its details on github from where you can
find the Pull-Request and associated discussions.


Commit on github: 
https://github.com/Rust-GCC/gccrs/commit/50b543a403c190cd9872d11d4b4b671ee7546a3d

The commit has been mentioned in the following issue(s):
 - Rust-GCC/gccrs#4814: https://github.com/Rust-GCC/gccrs/issues/4814

The commit has been mentioned in the following pull-request(s):
 - https://github.com/Rust-GCC/gccrs/pull/4816

 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 f21522b4d..e1c2cfa8e 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

base-commit: 81891ef3dd77963a53f17b2078f3958fc3e76f0e
-- 
2.55.0

Reply via email to