Skip to content

Conversation

powerboat9
Copy link
Collaborator

This is a simpler version of #4064. I think I'll probably revisit this latter, to try to improve eager expansion -- it seems like we do a lot of unnecessary tokens -> AST -> tokens -> AST conversions.

This allows format_args!(some_macro!(...), ...) to compile.

gcc/rust/ChangeLog:

	* expand/rust-macro-builtins-format-args.cc
	(format_args_parse_arguments): Split format expression parsing
	into...
	(format_args_parse_expr): ...a new function here, while handling
	eager expansion.
	(MacroBuiltin::format_args_handler): Use format_args_parse_expr.

gcc/testsuite/ChangeLog:

	* rust/compile/format_args_concat.rs: New test.

Signed-off-by: Owen Avery <[email protected]>
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.

LGTM, thanks!

@CohenArthur CohenArthur added this pull request to the merge queue Aug 25, 2025
@CohenArthur
Copy link
Member

Should we close #4064?

Merged via the queue into Rust-GCC:master with commit 71ed970 Aug 25, 2025
13 checks passed
@powerboat9 powerboat9 deleted the format-eager-2 branch August 25, 2025 22:04
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