refactor(allocator): ChunkRawIter yield NonNull pointers#21738
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
Updates Arena::iter_allocated_chunks_raw() / ChunkRawIter to yield non-null chunk base pointers (NonNull<u8>) instead of potentially-null raw pointers, and adjusts iterator consumers/tests accordingly.
Changes:
- Refactor
ChunkRawIterto return(NonNull<u8>, usize)and updateChunkIterto build slices fromNonNull. - Update arena quickcheck tests to use
NonNullAPIs (addr(),as_ptr()) when comparing ranges/pointers. - Remove the now-unneeded
clippy::ptr_as_ptrexpectation from the arena test harness.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| crates/oxc_allocator/src/arena/chunks.rs | Changes ChunkRawIter to yield NonNull<u8> and updates ChunkIter slice construction accordingly. |
| crates/oxc_allocator/tests/arena/quickchecks.rs | Updates tests to collect raw chunks as (NonNull<u8>, usize) and compare addresses/pointers via NonNull APIs. |
| crates/oxc_allocator/tests/arena/main.rs | Drops clippy::ptr_as_ptr from the crate-level expected lint list. |
Merge activity
|
`ChunkRawIter` is an iterator over pointer & length pairs for an `Arena`'s chunks. Alter it to return `NonNull<u8>` pointers instead of `*mut u8` pointers. This is not a breaking change, as we do not expose the `Arena` type externally.
98805a7 to
3aadfcd
Compare
4288517 to
8fd3746
Compare

ChunkRawIteris an iterator over pointer & length pairs for anArena's chunks. Alter it to returnNonNull<u8>pointers instead of*mut u8pointers.This is not a breaking change, as we do not expose the
Arenatype externally.