rust/tests/run-make/wasm-panic-small/foo.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

28 lines
405 B
Rust
Raw Normal View History

#![crate_type = "cdylib"]
#[no_mangle]
#[cfg(a)]
pub fn foo() {
panic!("test");
}
#[no_mangle]
#[cfg(b)]
pub fn foo() {
panic!("{}", 1);
}
#[no_mangle]
#[cfg(c)]
pub fn foo() {
panic!("{}", "a");
}
#[no_mangle]
#[cfg(d)]
pub fn foo() -> usize {
use std::cell::Cell;
thread_local!(static A: Cell<Vec<u32>> = Cell::new(Vec::new()));
2020-04-21 14:11:32 -05:00
A.try_with(|x| x.take().len()).unwrap_or(0)
}