Skip to content

Stop using higher-order macros to declare arenas#159955

Open
Zalathar wants to merge 3 commits into
rust-lang:mainfrom
Zalathar:arena
Open

Stop using higher-order macros to declare arenas#159955
Zalathar wants to merge 3 commits into
rust-lang:mainfrom
Zalathar:arena

Conversation

@Zalathar

Copy link
Copy Markdown
Member

The arenas used by rustc_hir and rustc_middle are declared via macros. But instead of invoking rustc_arena::declare_arena! directly, those crates declare a higher-order macro containing a list of types, and then invoke that macro with declare_arena! as an argument.

From what I can tell, the only reason for this arrangement is so that the list of types can also contain [decode] modifiers that produce a corresponding implementation of RefDecodable that decodes into the arena. But the number of types involved is small enough that it's easy to list them separately, and the advantage of doing so is that we can remove a layer of macro indirection, making it easier to navigate to the real code.

There should be no change to compiler behaviour.

Zalathar added 3 commits July 26, 2026 18:42
This is a little more verbose than using a `[decode]` modifier, but will allow
us to stop using higher-order macros when declaring arenas.
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jul 26, 2026
@rustbot

rustbot commented Jul 26, 2026

Copy link
Copy Markdown
Collaborator

r? @camelid

rustbot has assigned @camelid.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

Why was this reviewer chosen?

The reviewer was selected based on:

  • Owners of files modified in this PR: compiler
  • compiler expanded to 74 candidates
  • Random selection from 16 candidates

@Zalathar

Copy link
Copy Markdown
Member Author

This will have textual conflicts with #159893.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants