]> git.lizzy.rs Git - rust.git/blob - tests/ui/mir/mir_drop_panics.rs
Add regression test for #42114
[rust.git] / tests / ui / mir / mir_drop_panics.rs
1 // run-fail
2 // needs-unwind
3 // error-pattern:panic 1
4 // error-pattern:drop 2
5
6 struct Droppable(u32);
7 impl Drop for Droppable {
8     fn drop(&mut self) {
9         if self.0 == 1 {
10             panic!("panic 1");
11         } else {
12             eprintln!("drop {}", self.0);
13         }
14     }
15 }
16
17 fn mir() {
18     let x = Droppable(2);
19     let y = Droppable(1);
20 }
21
22 fn main() {
23     mir();
24 }