diff --git a/src/frontend.rs b/src/frontend.rs index 0337391..17cb7b4 100644 --- a/src/frontend.rs +++ b/src/frontend.rs @@ -836,8 +836,9 @@ impl<'a, 'b> FunctionBodyBuilder<'a, 'b> { .map(|(_ty, value)| *value) .collect::>(); self.locals.start_block(*el); - self.locals.finish_block(); + self.cur_block = Some(*el); self.emit_branch(*out, &else_result_values[..]); + self.locals.finish_block(); assert_eq!(self.op_stack.len(), *start_depth); self.cur_block = Some(*out); self.locals.seal_block_preds(*out, &mut self.body); diff --git a/src/ir.rs b/src/ir.rs index 83d63e4..29a6346 100644 --- a/src/ir.rs +++ b/src/ir.rs @@ -414,7 +414,7 @@ impl Terminator { ) if i <= targets.len() => { f(&mut targets[i - 1]); } - _ => panic!("out of bounds"), + (i, this) => panic!("out of bounds: index {} term {:?}", i, this), } }