2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
|
|
|
//@ needs-unwind
|
|
|
|
//@ ignore-emscripten no threads support
|
2016-02-11 11:34:41 +00:00
|
|
|
|
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());
|
|
|
|
}
|