[gccrs COMMIT 3/5] gccrs: Fix ICE when ident is a lang item

gerris.rs@gmail.com gerris.rs@gmail.com
Wed Jun 24 09:24:50 GMT 2026


From: Philip Herron <herron.philip@googlemail.com>

gcc/rust/ChangeLog:

	* ast/rust-ast-collector.cc (TokenCollector::visit): check for lang item

Signed-off-by: Philip Herron <herron.philip@googlemail.com>
---
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/683f6d116c91d3022ede77db3916c516f4fd9b97

The commit has NOT been mentioned in any issue.

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

 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 12f3e106c..60be5e447 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)));
-- 
2.54.0



More information about the Gcc-rust mailing list