refactor(allocator): reduce scope of unsafe blocks in Arena chunk iterators#21778
Merged
graphite-app[bot] merged 1 commit intomainfrom Apr 26, 2026
Conversation
This was referenced Apr 26, 2026
Member
Author
This was referenced Apr 26, 2026
Merging this PR will not alter performance
Comparing Footnotes
|
1618da5 to
c5ed4e8
Compare
67ff1f2 to
a82c143
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors Arena’s chunk iterators to narrow unsafe blocks down to only the operations that require them, and adds focused // SAFETY: comments to document the invariants relied upon.
Changes:
- Refactor
ChunkIter::nextto moveunsafeto only theas_ref()dereference of the constructed slice pointer. - Refactor
ChunkRawIter::nextto moveunsafeto onlyfooter_ptr.as_ref()andoffset_from_unsigned(...), with added// SAFETY:explanations.
c5ed4e8 to
831cf9e
Compare
a82c143 to
1d77796
Compare
This was referenced Apr 26, 2026
Contributor
Merge activity
|
… iterators (#21778) Pure refactor. `Arena`'s 2 chunk iterators' `next` methods were each enclosed in a single `unsafe { ... }` block with no safety comments. Reduce the scope of `unsafe` blocks to just the statements where they're required, and add `// SAFETY` comments.
831cf9e to
674dfac
Compare
1d77796 to
6889c46
Compare
Base automatically changed from
om/04-26-fix_allocator_arena_retry_allocation_when_chunk_size_approaches_maximum
to
main
April 26, 2026 22:08
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Pure refactor.
Arena's 2 chunk iterators'nextmethods were each enclosed in a singleunsafe { ... }block with no safety comments. Reduce the scope ofunsafeblocks to just the statements where they're required, and add// SAFETYcomments.