Skip to content

Commit d71e2a7

Browse files
jhprattgitbot
authored and
gitbot
committed
Rollup merge of rust-lang#131830 - hoodmane:emscripten-wasm-eh, r=workingjubilee
Add support for wasm exception handling to Emscripten target This is a draft because we need some additional setting for the Emscripten target to select between the old exception handling and the new exception handling. I don't know how to add a setting like that, would appreciate advice from Rust folks. We could maybe choose to use the new exception handling if `Ctarget-feature=+exception-handling` is passed? I tried this but I get errors from llvm so I'm not doing it right.
2 parents fbd5a05 + b3e6b8b commit d71e2a7

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

panic_unwind/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,4 @@ libc = { version = "0.2", default-features = false }
2323

2424
[lints.rust.unexpected_cfgs]
2525
level = "warn"
26-
check-cfg = []
26+
check-cfg = ['cfg(emscripten_wasm_eh)']

panic_unwind/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,14 @@
2525
// `real_imp` is unused with Miri, so silence warnings.
2626
#![cfg_attr(miri, allow(dead_code))]
2727
#![allow(internal_features)]
28+
#![cfg_attr(not(bootstrap), feature(cfg_emscripten_wasm_eh))]
2829

2930
use alloc::boxed::Box;
3031
use core::any::Any;
3132
use core::panic::PanicPayload;
3233

3334
cfg_if::cfg_if! {
34-
if #[cfg(target_os = "emscripten")] {
35+
if #[cfg(all(target_os = "emscripten", not(emscripten_wasm_eh)))] {
3536
#[path = "emcc.rs"]
3637
mod imp;
3738
} else if #[cfg(target_os = "hermit")] {

unwind/Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,4 +37,4 @@ system-llvm-libunwind = []
3737

3838
[lints.rust.unexpected_cfgs]
3939
level = "warn"
40-
check-cfg = []
40+
check-cfg = ['cfg(emscripten_wasm_eh)']

unwind/src/lib.rs

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
#![feature(staged_api)]
55
#![cfg_attr(not(target_env = "msvc"), feature(libc))]
66
#![cfg_attr(
7-
all(target_family = "wasm", not(target_os = "emscripten")),
7+
all(target_family = "wasm", any(not(target_os = "emscripten"), emscripten_wasm_eh)),
88
feature(simd_wasm64, wasm_exception_handling_intrinsics)
99
)]
1010
#![allow(internal_features)]
11+
#![cfg_attr(not(bootstrap), feature(cfg_emscripten_wasm_eh))]
1112

1213
// Force libc to be included even if unused. This is required by many platforms.
1314
#[cfg(not(all(windows, target_env = "msvc")))]

0 commit comments

Comments
 (0)