feat(oxc_allocator)!: remove dangerous Allocator methods#18715
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. |
There was a problem hiding this comment.
Pull request overview
This PR removes several unsafe and dangerous methods from the Allocator that were previously required to support writing source text at the start of allocator chunks. Following PR #18714, which eliminated the need for source text to be at the start of chunks, these methods are no longer necessary and can be safely removed.
Changes:
- Removed
alloc_bytes_startmethod that allocated space at the start of a chunk (highly dangerous, required manual drop) - Removed
data_ptrandset_data_ptrmethods that manipulated the data pointer (could cause UB if misused) - Removed
cursor_ptrhelper method that retrieved the cursor pointer - Removed
chunk_footerhelper method that retrieved an immutable reference to the chunk footer
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
71058c7 to
2c6c42b
Compare
b2cdab5 to
b91f07f
Compare
Merge activity
|
Remove several unsafe and potentially dangerous methods from `Allocator`. These methods were only required in order to support writing source text into start of allocator chunk, instead of bumping downwards in the usual way. #18714 has removed the need for source text to be at start of allocator chunks, so we can now remove these methods. This is a breaking change, but the docs stated that use of these methods was inadvisable, so hopefully no-one is depending on them. https://github.com/oxc-project/oxc/blob/b82faec35c486c0fcdb8a242a626554d2c99a310/crates/oxc_allocator/src/lib.rs#L24-L25
2c6c42b to
e39a983
Compare
b91f07f to
445cb1a
Compare
### 💥 BREAKING CHANGES - 445cb1a oxc_allocator: [**BREAKING**] Remove dangerous `Allocator` methods (#18715) (overlookmotel) ### 🚀 Features - 8670b18 parser: Error on ambient class accessor implementations (#18592) (camc314) ### 🐛 Bug Fixes - 2e34461 minifier: Prevent expression inlining into block-scoped for-in declarations (#18651) (copilot-swe-agent) ### 📚 Documentation - 3d01fa1 transformer: Update links to use Oxc docs (#18722) (sapphi-red) Co-authored-by: camc314 <18101008+camc314@users.noreply.github.com>

Remove several unsafe and potentially dangerous methods from
Allocator. These methods were only required in order to support writing source text into start of allocator chunk, instead of bumping downwards in the usual way.#18714 has removed the need for source text to be at start of allocator chunks, so we can now remove these methods.
This is a breaking change, but the docs stated that use of these methods was inadvisable, so hopefully no-one is depending on them.
oxc/crates/oxc_allocator/src/lib.rs
Lines 24 to 25 in b82faec