From 98da9ee8a96aeb5bea3af86f8096236411e7937c Mon Sep 17 00:00:00 2001 From: Nick Fitzgerald Date: Mon, 1 Jun 2020 13:54:26 -0700 Subject: [PATCH] Use `std::alloc::handle_alloc_failure` instead of home-rolled version --- crates/runtime/src/externref.rs | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/crates/runtime/src/externref.rs b/crates/runtime/src/externref.rs index 10cc2f12ad..1a43e33932 100644 --- a/crates/runtime/src/externref.rs +++ b/crates/runtime/src/externref.rs @@ -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::(); @@ -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() }