Skip to content

Commit 456e555

Browse files
committed
better error
1 parent c7042fd commit 456e555

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

  • compiler/codegen/src

‎compiler/codegen/src/ir.rs‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,8 @@ impl CodeInfo {
244244
let instr_display = instr.display(display_arg, self);
245245
eprint!("{instr_display}: {depth} {effect:+} => ");
246246
}
247-
let new_depth = depth.checked_add_signed(effect).unwrap();
247+
// Either it's less than 0 or more than u32. Option 1 is far more likely unless something is seriously wrong.
248+
let new_depth = depth.checked_add_signed(effect).expect("The stack is detected to have likely been reduced to less than 0 elements, this is a bug.");
248249
if DEBUG {
249250
eprintln!("{new_depth}");
250251
}

0 commit comments

Comments
 (0)