]>
Commit | Line | Data |
---|---|---|
1 | // run-fail | |
2 | // error-pattern:diverging_fn called | |
3 | // error-pattern:0 dropped | |
4 | // needs-unwind this test checks that a destructor is called after panicking | |
5 | ||
6 | struct Droppable(u8); | |
7 | impl Drop for Droppable { | |
8 | fn drop(&mut self) { | |
9 | eprintln!("{} dropped", self.0); | |
10 | } | |
11 | } | |
12 | ||
13 | fn diverging_fn() -> ! { | |
14 | panic!("diverging_fn called") | |
15 | } | |
16 | ||
17 | fn mir(d: Droppable) { | |
18 | diverging_fn(); | |
19 | } | |
20 | ||
21 | fn main() { | |
22 | let d = Droppable(0); | |
23 | mir(d); | |
24 | } |