E0008 — Division by zero

A / or % operation was evaluated with a zero divisor at runtime.


What triggers it

Resilient doesn’t silently return NaN or overflow on a divide-by-zero — it errors out so failures surface near the cause, not three layers deep in a dependent calculation. The check happens in all three backends (interpreter, VM, JIT).

Minimal example

fn main() {
    let n = 0;
    return 100 / n;
}

Output:

scratch.rs:3:12: error[E0008]: division by zero
   return 100 / n;
          ^^^^^^^

Fix

Guard the divisor before the operation, or add a requires n != 0 contract to the enclosing function so the check is lifted out. For programs you want Z3-verified ahead of time, see Verifying with Z3.

fn main() {
    let n = 0;
    if n == 0 {
        return 0;
    }
    return 100 / n;
}

Source

Emitted from the interpreter (Interpreter::eval, arithmetic arm), the VM (Op::Div / Op::Mod dispatch in resilient/src/vm.rs), and the JIT.