1 // run-pass
2 // ignore-emscripten no threads support
3 
4 use std::thread;
5 
6 struct Foo(i32);
7 
8 impl Drop for Foo {
drop(&mut self)9     fn drop(&mut self) {
10         static mut DROPPED: bool = false;
11         unsafe {
12             assert!(!DROPPED);
13             DROPPED = true;
14         }
15     }
16 }
17 
18 struct Empty;
19 
empty() -> Empty20 fn empty() -> Empty { Empty }
21 
should_panic(_: Foo, _: Empty)22 fn should_panic(_: Foo, _: Empty) {
23     panic!("test panic");
24 }
25 
test()26 fn test() {
27     should_panic(Foo(1), empty());
28 }
29 
main()30 fn main() {
31     let ret = thread::spawn(test).join();
32     assert!(ret.is_err());
33 }
34