diff options
Diffstat (limited to 'library/unwind/src/wasm.rs')
| -rw-r--r-- | library/unwind/src/wasm.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/library/unwind/src/wasm.rs b/library/unwind/src/wasm.rs index 2d36a8be004..3341e54759a 100644 --- a/library/unwind/src/wasm.rs +++ b/library/unwind/src/wasm.rs @@ -45,18 +45,19 @@ pub unsafe fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwi // via integers, with 0 corresponding to C++ exceptions and 1 to C setjmp()/longjmp(). // Ideally, we'd be able to choose something unique for Rust, but for now, // we pretend to be C++ and implement the Itanium exception-handling ABI. - cfg_if::cfg_if! { + cfg_select! { // panic=abort is default for wasm targets. Because an unknown instruction is a load-time // error on wasm, instead of a runtime error like on traditional architectures, we never // want to codegen a `throw` instruction, as that would break users using runtimes that // don't yet support exceptions. The only time this first branch would be selected is if // the user explicitly opts in to wasm exceptions, via -Zbuild-std with -Cpanic=unwind. - if #[cfg(panic = "unwind")] { + panic = "unwind" => { // corresponds with llvm::WebAssembly::Tag::CPP_EXCEPTION // in llvm-project/llvm/include/llvm/CodeGen/WasmEHFuncInfo.h const CPP_EXCEPTION_TAG: i32 = 0; core::arch::wasm::throw::<CPP_EXCEPTION_TAG>(exception.cast()) - } else { + } + _ => { let _ = exception; core::arch::wasm::unreachable() } |
