Skip to content

Commit e4c80b4

Browse files
committed
refactor(allocator/vec2): import handle_alloc_error function from allocator_api2 instead of writing a custom one (#9860)
This `handle_alloc_error` function in `allocator-api2` is re-exported from `std::alloc::handle_alloc_error`, consider consistency, we temporarily import from `allocator-api2`
1 parent 385d009 commit e4c80b4

File tree

1 file changed

+1
-6
lines changed

1 file changed

+1
-6
lines changed

crates/oxc_allocator/src/vec2/raw_vec.rs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#![allow(unstable_name_collisions)]
2424
#![allow(dead_code)]
2525

26-
use allocator_api2::alloc::{AllocError, Allocator};
26+
use allocator_api2::alloc::{AllocError, Allocator, handle_alloc_error};
2727
use bumpalo::Bump;
2828

2929
pub use core::alloc::Layout;
@@ -678,11 +678,6 @@ fn capacity_overflow() -> ! {
678678
panic!("capacity overflow")
679679
}
680680

681-
// Copied from https://github.com/fitzgen/bumpalo/blob/1d2fbea9e3d0c2be56367b9ad5382ff33852a188/src/alloc.rs#L29-L31
682-
fn handle_alloc_error(layout: Layout) -> ! {
683-
panic!("encountered allocation error: {:?}", layout)
684-
}
685-
686681
// Copied from https://github.com/fitzgen/bumpalo/blob/1d2fbea9e3d0c2be56367b9ad5382ff33852a188/src/lib.rs#L482-L486
687682
/// Wrapper around `Layout::from_size_align` that adds debug assertions.
688683
#[inline]

0 commit comments

Comments
 (0)