Sakura Lang

D020 precondition_violated

A requires clause failed on entry.

A runtime defect: the running program stops with it; no compile phase reports it, and try cannot catch it. sakura explain D020 prints this explanation offline.

A requires clause failed on entry. The caller is blamed: the span is the call site. Check the condition before the call, or give the argument a refined type whose predicate implies the clause so the check happens where the value is made.

Runtime defects come from running programs, so compiler/tests/ui has no fixture for them; the explanation above names the repair.

Edit on GitHub