Skip to content

refactor(all): use ArenaBox and ArenaVec in generated code#23749

Merged
graphite-app[bot] merged 1 commit into
mainfrom
om/06-23-refactor_all_use_arenabox_and_arenavec_in_generated_code
Jun 24, 2026
Merged

refactor(all): use ArenaBox and ArenaVec in generated code#23749
graphite-app[bot] merged 1 commit into
mainfrom
om/06-23-refactor_all_use_arenabox_and_arenavec_in_generated_code

Conversation

@overlookmotel

@overlookmotel overlookmotel commented Jun 23, 2026

Copy link
Copy Markdown
Member

Pure refactor.

#23747 changed all usage of Vec and Box to ArenaVec / ArenaBox in hand-written code. Do the same for generated code.

overlookmotel commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

How to use the Graphite Merge Queue

Add either label to this PR to merge it via the merge queue:

  • 0-merge - adds this PR to the back of the merge queue
  • hotfix - for urgent changes, fast-track this PR to the front of the merge queue

You must have a Graphite account in order to use the merge queue. Sign up using this link.

An organization admin has enabled the Graphite Merge Queue in this repository.

Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue.

This stack of pull requests is managed by Graphite. Learn more about stacking.

@github-actions github-actions Bot added A-minifier Area - Minifier A-ast Area - AST A-ast-tools Area - AST tools A-formatter Area - Formatter labels Jun 23, 2026
@codspeed-hq

codspeed-hq Bot commented Jun 23, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 62 untouched benchmarks
⏩ 9 skipped benchmarks1


Comparing om/06-23-refactor_all_use_arenabox_and_arenavec_in_generated_code (c8d8f4f) with om/06-23-refactor_all_shorten_redundant_std_vec_vec_ (44b3134)2

Open in CodSpeed

Footnotes

  1. 9 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on om/06-23-refactor_all_shorten_redundant_std_vec_vec_ (e3b8849) during the generation of this report, so d333bc4 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@overlookmotel overlookmotel marked this pull request as ready for review June 23, 2026 20:12
Copilot AI review requested due to automatic review settings June 23, 2026 20:12

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR continues the arena-type disambiguation refactor from #23747 by updating generated Rust code to use oxc_allocator::ArenaBox and oxc_allocator::ArenaVec (aliases of Box/Vec) instead of the plain Box/Vec names. This keeps generated code consistent with the hand-written codebase and reduces ambiguity with std::boxed::Box / std::vec::Vec.

Changes:

  • Update schema type definitions so generated type signatures emit ArenaVec / ArenaBox.
  • Update AST tool generators to import and emit ArenaVec / ArenaBox in generated outputs.
  • Regenerate affected outputs across oxc_traverse, oxc_minifier, oxc_formatter, and oxc_ast_visit to reflect the new names.

Reviewed changes

Copilot reviewed 8 out of 18 changed files in this pull request and generated no comments.

Show a summary per file
File Description
tasks/ast_tools/src/schema/defs/vec.rs Generate ArenaVec<...> for arena vector types in schema-driven codegen.
tasks/ast_tools/src/schema/defs/box.rs Generate ArenaBox<...> for arena boxed types in schema-driven codegen.
tasks/ast_tools/src/generators/visit.rs Update generated visitor code to import/use ArenaVec.
tasks/ast_tools/src/generators/traverse/walk.rs Update traverse-walk generator to import/use ArenaBox/ArenaVec and emit those names in helper type signatures.
tasks/ast_tools/src/generators/traverse/mod.rs Update traverse trait generator to use ArenaVec for the special Statements hook.
tasks/ast_tools/src/generators/traverse/ancestor.rs Update generated ancestor code imports to ArenaBox/ArenaVec.
tasks/ast_tools/src/generators/formatter/ast_nodes.rs Update formatter AST-node generator to import/use ArenaVec.
tasks/ast_tools/src/generators/ast_builder.rs Update builder generator imports and doc/examples to ArenaBox/ArenaVec and use ArenaBox::new_in.
crates/oxc_traverse/src/generated/walk.rs Regenerated traverse walker to use ArenaBox/ArenaVec throughout.
crates/oxc_traverse/src/generated/traverse.rs Regenerated traverse trait to use ArenaVec in enter_statements/exit_statements.
crates/oxc_minifier/src/generated/walk.rs Regenerated minifier walker to use ArenaBox/ArenaVec throughout.
crates/oxc_minifier/src/generated/traverse.rs Regenerated minifier traverse trait to use ArenaVec for statements hooks.
crates/oxc_formatter/src/ast_nodes/generated/ast_nodes.rs Regenerated formatter AST node accessors to use ArenaVec in exposed types.
crates/oxc_ast_visit/src/generated/visit.rs Regenerated Visit trait/walk fns to use ArenaVec.
crates/oxc_ast_visit/src/generated/visit_mut.rs Regenerated VisitMut trait/walk fns to use ArenaVec.

@overlookmotel overlookmotel force-pushed the om/06-23-refactor_all_shorten_redundant_std_vec_vec_ branch from 44b3134 to e3b8849 Compare June 23, 2026 20:30
@overlookmotel overlookmotel force-pushed the om/06-23-refactor_all_use_arenabox_and_arenavec_in_generated_code branch from 95dbcd0 to c8d8f4f Compare June 23, 2026 20:30
@Dunqing Dunqing added the 0-merge Merge with Graphite Merge Queue label Jun 24, 2026

Dunqing commented Jun 24, 2026

Copy link
Copy Markdown
Member

Merge activity

Pure refactor.

#23747 changed all usage of `Vec` and `Box` to `ArenaVec` / `ArenaBox` in hand-written code. Do the same for generated code.
graphite-app Bot pushed a commit that referenced this pull request Jun 24, 2026
#23747)

Pure refactor.

Use `ArenaBox` and `ArenaVec` everywhere for the arena-allocated types from `oxc_allocator`, instead of plain `Box` and `Vec`.

This disambiguates when `Vec` is `oxc_allocator::Vec` and when it's `std::vec::Vec`, making code clearer to follow.

Previously it was easy to confuse the two, and such confusion led to UB in `Traverse` (fixed in #23745).

Ditto other arena types - `ArenaHashMap`, `ArenaHashSet`, `ArenaStringBuilder`.

The only exceptions are:

1. Inside `oxc_allocator` crate itself.
2. AST type definitions.
3. Generated code (migrated separately in #23749).
@graphite-app graphite-app Bot force-pushed the om/06-23-refactor_all_shorten_redundant_std_vec_vec_ branch from e3b8849 to f65d8e5 Compare June 24, 2026 01:22
@graphite-app graphite-app Bot requested a review from camc314 as a code owner June 24, 2026 01:22
@graphite-app graphite-app Bot force-pushed the om/06-23-refactor_all_use_arenabox_and_arenavec_in_generated_code branch from c8d8f4f to e0c652b Compare June 24, 2026 01:23
@graphite-app graphite-app Bot removed the 0-merge Merge with Graphite Merge Queue label Jun 24, 2026
Base automatically changed from om/06-23-refactor_all_shorten_redundant_std_vec_vec_ to main June 24, 2026 01:28
@graphite-app graphite-app Bot merged commit e0c652b into main Jun 24, 2026
32 checks passed
@graphite-app graphite-app Bot deleted the om/06-23-refactor_all_use_arenabox_and_arenavec_in_generated_code branch June 24, 2026 01:28
camc314 pushed a commit that referenced this pull request Jul 3, 2026
#23747)

Pure refactor.

Use `ArenaBox` and `ArenaVec` everywhere for the arena-allocated types from `oxc_allocator`, instead of plain `Box` and `Vec`.

This disambiguates when `Vec` is `oxc_allocator::Vec` and when it's `std::vec::Vec`, making code clearer to follow.

Previously it was easy to confuse the two, and such confusion led to UB in `Traverse` (fixed in #23745).

Ditto other arena types - `ArenaHashMap`, `ArenaHashSet`, `ArenaStringBuilder`.

The only exceptions are:

1. Inside `oxc_allocator` crate itself.
2. AST type definitions.
3. Generated code (migrated separately in #23749).
camc314 pushed a commit that referenced this pull request Jul 3, 2026
Pure refactor.

#23747 changed all usage of `Vec` and `Box` to `ArenaVec` / `ArenaBox` in hand-written code. Do the same for generated code.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-ast Area - AST A-ast-tools Area - AST tools A-formatter Area - Formatter A-minifier Area - Minifier

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants