Skip to content

Conversation

@powerboat9
Copy link
Collaborator

This is imperfect, as invalid macro definitions should be detected regardless of whether a macro is used or not.

This is imperfect, as invalid macro definitions should be detected
regardless of whether a macro is used or not.

gcc/rust/ChangeLog:

	* expand/rust-macro-expand.cc
	(MacroExpander::expand_decl_macro): Prevent excess errors.
	(MacroExpander::match_matcher): Detect duplicate metavariable
	names.
	* expand/rust-macro-expand.h (MacroExpander::MacroExpander):
	Initialize field had_duplicate_error.
	(MacroExpander::had_duplicate_error): New field.

gcc/testsuite/ChangeLog:

	* rust/compile/macros/mbe/macro-duplicate-binding.rs: New test.

Signed-off-by: Owen Avery <powerboat9.gamer@gmail.com>
@P-E-P P-E-P added this pull request to the merge queue Jan 22, 2026
Merged via the queue into Rust-GCC:master with commit d12d295 Jan 23, 2026
12 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.

2 participants