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;
|
|
|
|
|
2022-07-25 20:36:03 +00:00
|
|
|
struct Foo(#[allow(unused_tuple_struct_fields)] 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());
|
|
|
|
}
|