refactor(all): use ArenaBox and ArenaVec in generated code#23749
Conversation
How to use the Graphite Merge QueueAdd either label to this PR to merge it via 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. |
Merging this PR will not alter performance
Comparing Footnotes
|
There was a problem hiding this comment.
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/ArenaBoxin generated outputs. - Regenerate affected outputs across
oxc_traverse,oxc_minifier,oxc_formatter, andoxc_ast_visitto 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. |
44b3134 to
e3b8849
Compare
95dbcd0 to
c8d8f4f
Compare
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.
#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).
e3b8849 to
f65d8e5
Compare
c8d8f4f to
e0c652b
Compare
#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).
Pure refactor. #23747 changed all usage of `Vec` and `Box` to `ArenaVec` / `ArenaBox` in hand-written code. Do the same for generated code.

Pure refactor.
#23747 changed all usage of
VecandBoxtoArenaVec/ArenaBoxin hand-written code. Do the same for generated code.