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