2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2021-12-03 09:32:51 -06:00
|
|
|
// needs-unwind
|
2016-02-11 05:34:41 -06:00
|
|
|
// ignore-emscripten no threads support
|
|
|
|
|
2015-06-03 20:34:45 -05:00
|
|
|
use std::thread;
|
|
|
|
|
2022-07-25 15:36:03 -05:00
|
|
|
struct Foo(#[allow(unused_tuple_struct_fields)] i32);
|
2015-06-03 20:34:45 -05: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());
|
|
|
|
}
|