File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change @@ -40,6 +40,7 @@ pub unsafe fn _Unwind_DeleteException(exception: *mut _Unwind_Exception) {
4040}
4141
4242pub unsafe fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwind_Reason_Code {
43+ #[cfg(panic = "unwind")]
4344 extern "C" {
4445 /// LLVM lowers this intrinsic to the `throw` instruction.
4546 // FIXME(coolreader18): move to stdarch
@@ -52,5 +53,13 @@ pub unsafe fn _Unwind_RaiseException(exception: *mut _Unwind_Exception) -> _Unwi
5253 // via integers, with 0 corresponding to C++ exceptions and 1 to C setjmp()/longjmp().
5354 // Ideally, we'd be able to choose something unique for Rust, but for now,
5455 // we pretend to be C++ and implement the Itanium exception-handling ABI.
55- wasm_throw(0, exception.cast())
56+ cfg_if::cfg_if! {
57+ // for now, unless we're -Zbuild-std with panic=unwind, never codegen a throw.
58+ if #[cfg(panic = "unwind")] {
59+ wasm_throw(0, exception.cast())
60+ } else {
61+ let _ = exception;
62+ core::arch::wasm32::unreachable()
63+ }
64+ }
5665}
You can’t perform that action at this time.
0 commit comments