2018-08-30 12:18:55 +00:00
|
|
|
//@ run-pass
|
2021-12-03 15:32:51 +00:00
|
|
|
//@ needs-unwind
|
2016-02-11 11:34:41 +00:00
|
|
|
//@ ignore-emscripten no threads support
|
|
|
|
|
2015-06-04 01:34:45 +00:00
|
|
|
use std::thread;
|
|
|
|
|
2023-12-27 22:11:58 +00:00
|
|
|
struct Foo(#[allow(dead_code)] i32);
|
2015-06-04 01:34:45 +00:00
|
|
|
|
|
|
|
impl Drop for Foo {
|
|
|
|
fn drop(&mut self) {
|
|
|
|
static mut DROPPED: bool = false;
|
|
|
|
unsafe {
|
|
|
|
assert!(!DROPPED);
|
|
|
|
DROPPED = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
struct Empty;
|
|
|
|
|
|
|
|
fn empty() -> Empty { Empty }
|
|
|
|
|
|
|
|
fn should_panic(_: Foo, _: Empty) {
|
|
|
|
panic!("test panic");
|
|
|
|
}
|
|
|
|
|
|
|
|
fn test() {
|
|
|
|
should_panic(Foo(1), empty());
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let ret = thread::spawn(test).join();
|
|
|
|
assert!(ret.is_err());
|
|
|
|
}
|