refactor(allocator/vec): use assert_unchecked over unreachable_unchecked#15511
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. |
|
Small change, so merging without review. |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the pointer null-check assertions in Vec::as_ptr() and Vec::as_mut_ptr() methods to use the more direct std::hint::assert_unchecked function instead of the previous pattern using hint::unreachable_unchecked().
- Replaced conditional
unreachable_unchecked()calls with directassert_unchecked()calls - Updated the import from
hinttohint::assert_uncheckedfor direct function access - Simplified and modernized the implementation while maintaining identical semantics
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
CodSpeed Performance ReportMerging #15511 will not alter performanceComparing Summary
Footnotes |
4736143 to
ffa9d76
Compare
|
-2% perf regression on codegen benchmarks is just noise. These benchmarks are really noisy: https://codspeed.io/oxc-project/oxc/benchmarks/tasks/benchmark/benches/codegen.rs::codegen::bench_codegen::codegen%5Bcal.com.tsx%5D?runnerMode=Instrumentation&branchId=6910600bd9fb6b6c197529f3 |
Merge activity
|
…hecked` (#15511) Pure refactor. Use the newer `assert_unchecked` function instead of `unreachable_unchecked`. This does exactly the same thing, but is clearer. Also add a comment as to why this code exists.
ffa9d76 to
31718a8
Compare
…hecked` (#15511) Pure refactor. Use the newer `assert_unchecked` function instead of `unreachable_unchecked`. This does exactly the same thing, but is clearer. Also add a comment as to why this code exists.

Pure refactor. Use the newer
assert_uncheckedfunction instead ofunreachable_unchecked. This does exactly the same thing, but is clearer.Also add a comment as to why this code exists.