Status: Accepted
Date: November 8, 2026 (supervisor’s decision, by the language principles; asked by the owner)
Answers: ADR-306 §6, Division by zero, the third check
nobody writes that ADR-269 §6 names
Related: ADR-306 D15 (a check nobody writes that the
compiler shows fails is an error), ADR-269 D8 (a refutation is
a model checked by evaluation), ADR-359 D9 (refuted-claims),
Part I 1.4 and Part III 13.3, C.1 (NK1118)
A program has three checks nobody writes: an index stays inside its list, an
operation on whole numbers stays inside its type, and a divisor is not zero.
ADR-306 D15 makes the first two an error where the compiler shows they fail
for a value the program reaches. A divisor that is a constant zero is refused
already (NK1118), but a divisor the compiler shows is zero only through the
walk, as fn f(d: int) -> int { return 10 / d } called as f(0), builds and
stops the program where it runs. ADR-306 left this open.
A / or % on whole numbers whose divisor the walk shows is zero for a value
the program reaches is refused with NK1207, naming the value, as an index
past the end is (ADR-306 D15). Only on a refutation, never on unknown: a
model checked by evaluation (ADR-269 D8). refuted-claims = "warn" builds it
with the check, a warning where it is reached.
d != 0 for each divisor d that is not a literal is a goal of the walk, as
0 <= i < xs.len() is for an index, and the walk runs for it at every build,
whatever remove-*-checks says. A divisor that is a constant zero stays
NK1118, refused before the walk.
The check that a divisor is not zero stays in the machine code, proved or
not. Whether remove-overflow-checks may also drop a proved one is not part
of this decision; it is a question of speed and is asked with a measurement.
A test in tests/compiler/ with f(0) over 10 / d is refused with
NK1207 and the value; with refuted-claims = "warn" it builds and stops
where it runs; a divisor the walk cannot decide builds as today.