3 // error-pattern:unwind happens
4 // error-pattern:drop 3
5 // error-pattern:drop 2
6 // error-pattern:drop 1
7 // ignore-emscripten no processes
9 /// Structure which will not allow to be dropped twice.
10 struct Droppable<'a>(&'a mut bool, u32);
11 impl<'a> Drop for Droppable<'a> {
14 eprintln!("{} dropped twice", self.1);
15 ::std::process::exit(1);
17 eprintln!("drop {}", self.1);
22 fn may_panic<'a>() -> Droppable<'a> {
23 panic!("unwind happens");
26 fn mir<'a>(d: Droppable<'a>) {
27 let (mut a, mut b) = (false, false);
28 let y = Droppable(&mut a, 2);
29 let x = [Droppable(&mut b, 1), y, d, may_panic()];
34 mir(Droppable(&mut c, 3));