]> git.lizzy.rs Git - rust.git/blob - src/test/ui/structs-enums/unit-like-struct-drop-run.rs
Override rustc version in ui and mir-opt tests to get stable hashes
[rust.git] / src / test / ui / structs-enums / unit-like-struct-drop-run.rs
1 // run-pass
2 // needs-unwind
3 // ignore-emscripten no threads support
4
5 // Make sure the destructor is run for unit-like structs.
6
7 use std::thread;
8
9 struct Foo;
10
11 impl Drop for Foo {
12     fn drop(&mut self) {
13         panic!("This panic should happen.");
14     }
15 }
16
17 pub fn main() {
18     let x = thread::spawn(move|| {
19         let _b = Foo;
20     }).join();
21
22     let s = x.unwrap_err().downcast::<&'static str>().unwrap();
23     assert_eq!(&**s, "This panic should happen.");
24 }