[gcc r17-2225] gccrs: Fix ICE when ident is a lang item

Arthur Cohen via Gcc-cvs <[email protected]>
Newsgroups gmane.comp.gcc.cvs
Message-ID <[email protected]>
https://gcc.gnu.org/g:39356a0993305fb65d04c45c85749df694edefa5

commit r17-2225-g39356a0993305fb65d04c45c85749df694edefa5
Author: Philip Herron <[email protected]>
Date:   Sat Apr 18 22:23:41 2026 +0100

    gccrs: Fix ICE when ident is a lang item
    
    gcc/rust/ChangeLog:
    
            * ast/rust-ast-collector.cc (TokenCollector::visit): check for lang item
    
    Signed-off-by: Philip Herron <[email protected]>

Diff:
---
 gcc/rust/ast/rust-ast-collector.cc | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gcc/rust/ast/rust-ast-collector.cc b/gcc/rust/ast/rust-ast-collector.cc
index 12f3e106c8f0..60be5e4475d5 100644
--- a/gcc/rust/ast/rust-ast-collector.cc
+++ b/gcc/rust/ast/rust-ast-collector.cc
@@ -639,7 +639,10 @@ TokenCollector::visit (TypePathSegmentGeneric &segment)
   //    `<` `>`
   //    | `<` ( GenericArg `,` )* GenericArg `,`? `>`
   describe_node (std::string ("TypePathSegmentGeneric"), [this, &segment] () {
-    auto ident_segment = segment.get_ident_segment ();
+    auto ident_segment
+      = segment.is_lang_item ()
+	  ? PathIdentSegment ("LANG_ITEM", segment.get_locus ())
+	  : segment.get_ident_segment ();
     auto id = ident_segment.as_string ();
     push (Rust::Token::make_identifier (ident_segment.get_locus (),
 					std::move (id)));
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.