diff options
author | Philip Herron <herron.philip@googlemail.com> | 2025-07-31 21:17:18 +0100 |
---|---|---|
committer | Arthur Cohen <arthur.cohen@embecosm.com> | 2025-08-05 16:37:01 +0200 |
commit | 3e141c0cd3e0a926734bfb4f1c7f6f7558c47fa9 (patch) | |
tree | eabdd6cc377b57a634eb14844894928561e5edbb | |
parent | 7f0fed0bfea5ea401d99f8afd4ce9b159aaf9381 (diff) | |
download | gcc-3e141c0cd3e0a926734bfb4f1c7f6f7558c47fa9.zip gcc-3e141c0cd3e0a926734bfb4f1c7f6f7558c47fa9.tar.gz gcc-3e141c0cd3e0a926734bfb4f1c7f6f7558c47fa9.tar.bz2 |
gccrs: Fix ICE during hir dump of deferred anon constant
gcc/rust/ChangeLog:
* hir/rust-hir-dump.cc (Dump::visit): check for expression
* hir/tree/rust-hir.cc (AnonConst::as_string): likewise
Signed-off-by: Philip Herron <herron.philip@googlemail.com>
-rw-r--r-- | gcc/rust/hir/rust-hir-dump.cc | 5 | ||||
-rw-r--r-- | gcc/rust/hir/tree/rust-hir.cc | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/gcc/rust/hir/rust-hir-dump.cc b/gcc/rust/hir/rust-hir-dump.cc index afee7b4..0a2fc81 100644 --- a/gcc/rust/hir/rust-hir-dump.cc +++ b/gcc/rust/hir/rust-hir-dump.cc @@ -1302,7 +1302,10 @@ Dump::visit (AnonConst &e) begin ("AnonConst"); do_expr (e); - visit_field ("inner", e.get_inner_expr ()); + if (e.is_deferred ()) + put_field ("inner", "_"); + else + visit_field ("inner", e.get_inner_expr ()); end ("AnonConst"); } diff --git a/gcc/rust/hir/tree/rust-hir.cc b/gcc/rust/hir/tree/rust-hir.cc index dc94fb5..a802e8c 100644 --- a/gcc/rust/hir/tree/rust-hir.cc +++ b/gcc/rust/hir/tree/rust-hir.cc @@ -1055,7 +1055,10 @@ AnonConst::as_string () const std::string istr = indent_spaces (enter); std::string str = istr + "AnonConst:\n" + istr; - str += get_inner_expr ().as_string (); + if (expr.has_value ()) + str += get_inner_expr ().as_string (); + else + str += "_"; str += "\n" + indent_spaces (out); |