From: Philip Herron <[email protected]>
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 <[email protected]>
---
gcc/rust/hir/rust-hir-dump.cc | 5 ++++-
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 afee7b42f47..0a2fc818517 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 dc94fb5b1eb..a802e8cd055 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);
--
2.49.0