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