rust/library/std/src/sys
Jubilee 1279830068
Rollup merge of #121438 - coolreader18:wasm32-panic-unwind, r=cuviper
std support for wasm32 panic=unwind

Tracking issue: #118168

This adds std support for `-Cpanic=unwind` on wasm, and with it slightly more fleshed out rustc support. Now, the stable default is still panic=abort without exception-handling, but if you `-Zbuild-std` with `RUSTFLAGS=-Cpanic=unwind`, you get wasm exception-handling try/catch blocks in the binary:

```rust
#[no_mangle]
pub fn foo_bar(x: bool) -> *mut u8 {
    let s = Box::<str>::from("hello");
    maybe_panic(x);
    Box::into_raw(s).cast()
}

#[inline(never)]
#[no_mangle]
fn maybe_panic(x: bool) {
    if x {
        panic!("AAAAA");
    }
}
```
```wat
;; snip...
(try $label$5
 (do
  (call $maybe_panic
   (local.get $0)
  )
  (br $label$1)
 )
 (catch_all
  (global.set $__stack_pointer
   (local.get $1)
  )
  (call $__rust_dealloc
   (local.get $2)
   (i32.const 5)
   (i32.const 1)
  )
  (rethrow $label$5)
 )
)
;; snip...
```
2024-03-11 09:29:34 -07:00
..
locks Windows: Implement mutex using futex 2024-03-05 00:19:42 +00:00
os_str Move OsStr::slice_encoded_bytes validation to platform modules 2024-01-21 19:51:49 +01:00
pal Auto merge of #122331 - jhpratt:rollup-cbl8xsy, r=jhpratt 2024-03-11 10:22:10 +00:00
path std: move path into sys 2024-02-08 12:51:35 +01:00
personality std support for wasm32 panic=unwind 2024-02-22 16:45:26 -06:00
thread_local std: move thread local implementation to sys 2024-02-28 19:12:29 +01:00
cmath.rs Make cmath.rs a single file 2024-02-07 12:02:24 -03:00
mod.rs std: move thread local implementation to sys 2024-02-28 19:12:29 +01:00