rust/tests/ui/panics/short-ice-remove-middle-frames-2.rs
Alex Crichton cf6d6050f7 Update test directives for wasm32-wasip1
* The WASI targets deal with the `main` symbol a bit differently than
  native so some `codegen` and `assembly` tests have been ignored.
* All `ignore-emscripten` directives have been updated to
  `ignore-wasm32` to be more clear that all wasm targets are ignored and
  it's not just Emscripten.
* Most `ignore-wasm32-bare` directives are now gone.
* Some ignore directives for wasm were switched to `needs-unwind`
  instead.
* Many `ignore-wasm32*` directives are removed as the tests work with
  WASI as opposed to `wasm32-unknown-unknown`.
2024-03-11 09:36:35 -07:00

62 lines
1.2 KiB
Rust

//@ compile-flags:-Cstrip=none
//@ run-fail
//@ check-run-results
//@ exec-env:RUST_BACKTRACE=1
//@ needs-unwind
//@ ignore-android FIXME #17520
//@ ignore-openbsd no support for libbacktrace without filename
//@ ignore-emscripten no panic
//@ ignore-sgx Backtraces not symbolized
//@ ignore-fuchsia Backtraces not symbolized
//@ ignore-msvc the `__rust_{begin,end}_short_backtrace` symbols aren't reliable.
/// This test case make sure that we can have multiple pairs of `__rust_{begin,end}_short_backtrace`
#[inline(never)]
fn __rust_begin_short_backtrace<T, F: FnOnce() -> T>(f: F) -> T {
let result = f();
std::hint::black_box(result)
}
#[inline(never)]
fn __rust_end_short_backtrace<T, F: FnOnce() -> T>(f: F) -> T {
let result = f();
std::hint::black_box(result)
}
fn first() {
__rust_end_short_backtrace(|| second());
}
fn second() {
third(); // won't show up
}
fn third() {
fourth(); // won't show up
}
fn fourth() {
__rust_begin_short_backtrace(|| fifth());
}
fn fifth() {
__rust_end_short_backtrace(|| sixth());
}
fn sixth() {
seven(); // won't show up
}
fn seven() {
__rust_begin_short_backtrace(|| eight());
}
fn eight() {
panic!("debug!!!");
}
fn main() {
first();
}