Use std::alloc::handle_alloc_failure instead of home-rolled version

This commit is contained in:
Nick Fitzgerald
2020-06-01 13:54:26 -07:00
parent 25548d7fbe
commit 98da9ee8a9

View File

@@ -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() }