From 7f0fed0bfea5ea401d99f8afd4ce9b159aaf9381 Mon Sep 17 00:00:00 2001 From: Philip Herron Date: Thu, 31 Jul 2025 21:16:36 +0100 Subject: [PATCH] gccrs: Fix ICE for ast dump of deferred anon const gcc/rust/ChangeLog: * ast/rust-ast-collector.cc (TokenCollector::visit): check for value Signed-off-by: Philip Herron --- gcc/rust/ast/rust-ast-collector.cc | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc index f4033ad4aae..b27a3af11e8 100644 --- a/gcc/rust/ast/rust-ast-collector.cc +++ b/gcc/rust/ast/rust-ast-collector.cc @@ -1274,7 +1274,13 @@ TokenCollector::visit (BlockExpr &expr) void TokenCollector::visit (AnonConst &expr) { - visit (expr.get_inner_expr ()); + if (!expr.is_deferred ()) + { + visit (expr.get_inner_expr ()); + return; + } + + push (Rust::Token::make_string (expr.get_locus (), "_")); } void -- 2.47.2