P0004

Division by zero: the right operand of / or % is zero. Spans the operation.

Machine-applicable fix: none.

Example

This program fails with P0004.

fn main() {
    let zero = 0
    let n = 10 / zero
}

Fixed

The same program, fixed.

fn main() {
    let two = 2
    let n = 10 / two
}

Listed in the runtime notes. oskac explain P0004 prints this entry offline.

All error codes