Skip to content
This repository was archived by the owner on Aug 25, 2025. It is now read-only.
Open
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
14 changes: 5 additions & 9 deletions example/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,26 +20,22 @@ static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT;
// raise a `trap` the WebAssembly execution if we panic at runtime.
#[panic_handler]
#[no_mangle]
pub fn panic(_info: &::core::panic::PanicInfo) -> ! {
unsafe {
::core::intrinsics::abort();
}
unsafe fn panic(_info: &::core::panic::PanicInfo) -> ! {
::core::intrinsics::abort();
}

// Need to provide an allocation error handler which just aborts
// the execution with trap.
#[alloc_error_handler]
#[no_mangle]
pub extern "C" fn oom(_: ::core::alloc::Layout) -> ! {
unsafe {
::core::intrinsics::abort();
}
unsafe fn oom(_: ::core::alloc::Layout) -> ! {
::core::intrinsics::abort();
}

// Needed for non-wasm targets.
#[lang = "eh_personality"]
#[no_mangle]
pub extern "C" fn eh_personality() {}
extern "C" fn eh_personality() {}

// Now, use the allocator via `alloc` types! ///////////////////////////////////

Expand Down