Skip to content

ast-exporter: Export some macro arg expansions#1792

Draft
Rua wants to merge 11 commits into
immunant:masterfrom
Rua:fn-macro-args-fix
Draft

ast-exporter: Export some macro arg expansions#1792
Rua wants to merge 11 commits into
immunant:masterfrom
Rua:fn-macro-args-fix

Conversation

@Rua
Copy link
Copy Markdown
Contributor

@Rua Rua commented May 10, 2026

The "chain" of expansions is a little different for macros with args (that is, functional macros). This PR does two things:

  • Handles arg expansions differently, so that const macros that call functional macros are now expanded.
  • Exports the arg info to the Rust side to be used to hopefully make functional macros possible later.

Not all macro args are currently handled by this because of technical limitations. This code is only able to "see" macro args in the macro where they were expanded into tokens. They are not visible in macros that take an arg and then pass it on to another macro call in an arg. Maybe a solution will eventually be found for that. For now at least, the AST on the Rust side contains expressions that are macro arg expansions!

@Rua Rua marked this pull request as draft May 11, 2026 13:48
@Rua Rua force-pushed the fn-macro-args-fix branch 6 times, most recently from 29c07b0 to e861f34 Compare May 14, 2026 09:49
@Rua Rua changed the title ast-exporter: Skip over macro arg expansions ast-exporter: Export some macro arg expansions May 14, 2026
@Rua Rua force-pushed the fn-macro-args-fix branch 2 times, most recently from 95dc68a to b13d905 Compare May 15, 2026 09:44
@Rua Rua force-pushed the fn-macro-args-fix branch from b13d905 to 465f6a7 Compare May 19, 2026 15:43
@Rua Rua force-pushed the fn-macro-args-fix branch from 465f6a7 to d497df5 Compare May 23, 2026 12:11
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.

1 participant