Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions crates/oxc_allocator/src/vec2/raw_vec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -794,18 +794,20 @@ impl<T, A: Alloc> RawVec<'_, T, A> {
Some(layout) => unsafe {
// Marking this function as `#[cold]` and `#[inline(never)]` because grow method is
// relatively expensive and we want to avoid inlining it into the caller.
// Type-erased (no `T` parameter) to avoid monomorphization bloat - the type is
// immediately cast to `u8` anyway.
#[cold]
#[inline(never)]
unsafe fn grow<T, A: Alloc>(
unsafe fn grow<A: Alloc>(
alloc: &A,
ptr: NonNull<T>,
ptr: NonNull<u8>,
old_layout: Layout,
new_layout: Layout,
) -> NonNull<u8> {
alloc.grow(ptr.cast(), old_layout, new_layout)
alloc.grow(ptr, old_layout, new_layout)
}
debug_assert!(new_layout.align() == layout.align());
grow(self.alloc, self.ptr, layout, new_layout)
grow(self.alloc, self.ptr.cast(), layout, new_layout)
},
None => self.alloc.alloc(new_layout),
};
Expand Down
Loading