Unverified Commit fe5f83a9 authored by Michael Müller's avatar Michael Müller Committed by GitHub
Browse files

Mark wasm32 `unreachable` as safe (#905)

The function was recently marked as safe:
https://doc.rust-lang.org/nightly/core/arch/wasm32/fn.unreachable.html.

>This function is safe to call and immediately aborts the execution.
parent 45ef4132
Pipeline #155739 failed with stages
in 10 minutes and 3 seconds
...@@ -50,12 +50,10 @@ fn panic(info: &core::panic::PanicInfo) -> ! { ...@@ -50,12 +50,10 @@ fn panic(info: &core::panic::PanicInfo) -> ! {
// This code gets removed in release builds where the macro will expand into nothing. // This code gets removed in release builds where the macro will expand into nothing.
debug_print!("{}\n", info); debug_print!("{}\n", info);
// SAFETY: We only use this operation if we are guaranteed to be in Wasm32 compilation. // We only use this operation if we are guaranteed to be in Wasm32 compilation.
// This is used in order to make any panic a direct abort avoiding Rust's general // This is used in order to make any panic a direct abort avoiding Rust's general
// panic infrastructure. // panic infrastructure.
unsafe { core::arch::wasm32::unreachable();
core::arch::wasm32::unreachable();
}
} }
// This extern crate definition is required since otherwise rustc // This extern crate definition is required since otherwise rustc
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment