Use std::alloc::handle_alloc_failure instead of home-rolled version
This commit is contained in:
@@ -281,7 +281,7 @@ impl VMExternRef {
|
||||
|
||||
let alloc_ptr = std::alloc::alloc(layout);
|
||||
let alloc_ptr = NonNull::new(alloc_ptr).unwrap_or_else(|| {
|
||||
Self::alloc_failure();
|
||||
std::alloc::handle_alloc_error(layout);
|
||||
});
|
||||
|
||||
let value_ptr = alloc_ptr.cast::<T>();
|
||||
@@ -338,12 +338,6 @@ impl VMExternRef {
|
||||
VMExternRef(NonNull::new_unchecked(ptr).cast())
|
||||
}
|
||||
|
||||
#[inline(never)]
|
||||
#[cold]
|
||||
fn alloc_failure() -> ! {
|
||||
panic!("VMExternRef allocation failure")
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn extern_data(&self) -> &VMExternData {
|
||||
unsafe { self.0.as_ref() }
|
||||
|
||||
Reference in New Issue
Block a user