]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: fix segfault on exported macro
authorLucas Ly Ba <lucas.ly-ba@outlook.fr>
Wed, 15 Oct 2025 13:23:05 +0000 (13:23 +0000)
committerArthur Cohen <arthur.cohen@embecosm.com>
Mon, 17 Nov 2025 14:58:17 +0000 (15:58 +0100)
commitc8bd8f99fe2fe98622fe8da9006b162a343f5cb6
tree4dd4d3169e5787da15d345aa1d6235c4cd9ba11a
parent9acc6d887647301a2d1c6b3559d16996c47f0801
gccrs: fix segfault on exported macro

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>
gcc/rust/metadata/rust-export-metadata.cc
gcc/rust/metadata/rust-export-metadata.h
gcc/rust/util/rust-hir-map.cc
gcc/rust/util/rust-hir-map.h
gcc/testsuite/rust/compile/issue-3617.rs [new file with mode: 0644]