Skip to content

refactor(allocator): fix ref_as_ptr clippy warnings#21220

Merged
graphite-app[bot] merged 1 commit intomainfrom
om/04-08-refactor_allocator_fix_ref_as_ptr_clippy_warnings
Apr 9, 2026
Merged

refactor(allocator): fix ref_as_ptr clippy warnings#21220
graphite-app[bot] merged 1 commit intomainfrom
om/04-08-refactor_allocator_fix_ref_as_ptr_clippy_warnings

Conversation

@overlookmotel
Copy link
Copy Markdown
Member

@overlookmotel overlookmotel commented Apr 9, 2026

Continuation of #21210.

Replace x as *const T / x as *mut T with ptr::from_ref(x) / ptr::from_mut(x). Note that this change does not materialize any references which did not already exist in original code.

Copy link
Copy Markdown
Member Author

overlookmotel commented Apr 9, 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 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.

@codspeed-hq
Copy link
Copy Markdown

codspeed-hq bot commented Apr 9, 2026

Merging this PR will not alter performance

✅ 48 untouched benchmarks
⏩ 3 skipped benchmarks1


Comparing om/04-08-refactor_allocator_fix_ref_as_ptr_clippy_warnings (4d0b39f) with om/04-08-refactor_allocator_fix_borrow_as_ptr_clippy_warnings (87fef2d)

Open in CodSpeed

Footnotes

  1. 3 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.

@overlookmotel overlookmotel marked this pull request as ready for review April 9, 2026 07:57
Copilot AI review requested due to automatic review settings April 9, 2026 07:57
Copy link
Copy Markdown
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

Refactors oxc_allocator’s bump allocator implementation to eliminate clippy::ref_as_ptr warnings by replacing reference-to-pointer casts with core::ptr::from_ref / core::ptr::from_mut, keeping the same unsafe semantics while using the modern, lint-friendly APIs.

Changes:

  • Remove clippy::ref_as_ptr from the file-level #![expect(...)] list.
  • Replace x as *const T / x as *mut T patterns (where x is a reference) with ptr::from_ref(x) / ptr::from_mut(x) in unsafe pointer-based code paths.
  • Update a couple of ptr::read call sites to use ptr::from_ref rather than casting.

@overlookmotel overlookmotel self-assigned this Apr 9, 2026
@graphite-app
Copy link
Copy Markdown
Contributor

graphite-app bot commented Apr 9, 2026

Merge activity

Continuation of #21210.

Replace `x as *const T` /  `x as *mut T` with `ptr::from_ref(x)` / `ptr::from_mut(x)`. Note that this change does not materialize any references which did not already exist in original code.
@graphite-app graphite-app bot force-pushed the om/04-08-refactor_allocator_fix_borrow_as_ptr_clippy_warnings branch from d589299 to 87fef2d Compare April 9, 2026 08:50
@graphite-app graphite-app bot force-pushed the om/04-08-refactor_allocator_fix_ref_as_ptr_clippy_warnings branch from 1bd3605 to 4d0b39f Compare April 9, 2026 08:51
Base automatically changed from om/04-08-refactor_allocator_fix_borrow_as_ptr_clippy_warnings to main April 9, 2026 09:10
@graphite-app graphite-app bot merged commit 4d0b39f into main Apr 9, 2026
37 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-allocator Area - Allocator C-cleanup Category - technical debt or refactoring. Solution not expected to change behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants