Skip to content

Conversation

@lucasly-ba
Copy link

@lucasly-ba lucasly-ba commented Oct 15, 2025

An imbricated exported macro leads to a segfault.

Fixes #3617

gcc/rust/ChangeLog:

* metadata/rust-export-metadata.cc (ExportContext::emit_macro): Change method argument NodeId to AST::MacroRulesDefinition.
* metadata/rust-export-metadata.h: Likewise.
* util/rust-hir-map.cc (Mappings::insert_exported_macro): Insert AST::MacroRulesDefinition instead of NodeId.
* util/rust-hir-map.h: Change methods declarations of exported macros.

gcc/testsuite/ChangeLog:

* rust/compile/issue-3617.rs: New test.

Signed-off-by: Lucas Ly Ba lucas.ly-ba@outlook.fr

Copy link
Member

@CohenArthur CohenArthur left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great job - just fix my nitpick and we can merge this. LGTM!

An imbricated exported macro leads to a segfault.

gcc/rust/ChangeLog:

	* metadata/rust-export-metadata.cc (ExportContext::emit_macro):
	Change method argument NodeId to AST::MacroRulesDefinition.
	* metadata/rust-export-metadata.h:
	Likewise.
	* util/rust-hir-map.cc (Mappings::insert_exported_macro):
	Insert AST::MacroRulesDefinition instead of NodeId.
	* util/rust-hir-map.h:
	Change methods declarations of exported macros.

gcc/testsuite/ChangeLog:

	* rust/compile/issue-3617.rs: New test.

Signed-off-by: Lucas Ly Ba <lucas.ly-ba@outlook.fr>
@CohenArthur CohenArthur added this pull request to the merge queue Oct 31, 2025
Merged via the queue into Rust-GCC:master with commit 96539d7 Oct 31, 2025
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE: segfault TokenCollector

2 participants