Skip to content

feat(oxc_allocator)!: remove dangerous Allocator methods#18715

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/01-29-feat_oxc_allocator_remove_dangerous_allocator_methods
Jan 30, 2026
Merged

feat(oxc_allocator)!: remove dangerous Allocator methods#18715
graphite-app[bot] merged 1 commit intomainfrom
om/01-29-feat_oxc_allocator_remove_dangerous_allocator_methods

Conversation

@overlookmotel
Copy link
Member

@overlookmotel overlookmotel commented Jan 30, 2026

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.

//! * `from_raw_parts` - Adds `Allocator::from_raw_parts` method.
//! Usage of this feature is not advisable, and it will be removed as soon as we're able to.

Copy link
Member Author

overlookmotel commented Jan 30, 2026


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 hot fixes, skip the queue and merge this PR next

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.

@overlookmotel overlookmotel marked this pull request as ready for review January 30, 2026 00:37
Copilot AI review requested due to automatic review settings January 30, 2026 00:37
Copy link
Contributor

Copilot AI left a comment

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 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_start method that allocated space at the start of a chunk (highly dangerous, required manual drop)
  • Removed data_ptr and set_data_ptr methods that manipulated the data pointer (could cause UB if misused)
  • Removed cursor_ptr helper method that retrieved the cursor pointer
  • Removed chunk_footer helper method that retrieved an immutable reference to the chunk footer

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@overlookmotel overlookmotel force-pushed the om/01-29-refactor_linter_plugins_store_source_text_in_end_of_buffer branch from 71058c7 to 2c6c42b Compare January 30, 2026 00:44
@overlookmotel overlookmotel force-pushed the om/01-29-feat_oxc_allocator_remove_dangerous_allocator_methods branch from b2cdab5 to b91f07f Compare January 30, 2026 00:44
@overlookmotel overlookmotel self-assigned this Jan 30, 2026
@overlookmotel overlookmotel added the 0-merge Merge with Graphite Merge Queue label Jan 30, 2026
Copy link
Member Author

overlookmotel commented Jan 30, 2026

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
@graphite-app graphite-app bot force-pushed the om/01-29-refactor_linter_plugins_store_source_text_in_end_of_buffer branch from 2c6c42b to e39a983 Compare January 30, 2026 00:52
@graphite-app graphite-app bot requested a review from camc314 as a code owner January 30, 2026 00:52
@graphite-app graphite-app bot force-pushed the om/01-29-feat_oxc_allocator_remove_dangerous_allocator_methods branch from b91f07f to 445cb1a Compare January 30, 2026 00:52
Base automatically changed from om/01-29-refactor_linter_plugins_store_source_text_in_end_of_buffer to main January 30, 2026 00:58
@graphite-app graphite-app bot removed the 0-merge Merge with Graphite Merge Queue label Jan 30, 2026
@graphite-app graphite-app bot merged commit 445cb1a into main Jan 30, 2026
23 checks passed
@graphite-app graphite-app bot deleted the om/01-29-feat_oxc_allocator_remove_dangerous_allocator_methods branch January 30, 2026 00:59
camc314 added a commit that referenced this pull request Feb 2, 2026
### 💥 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-enhancement Category - New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants