Home / Docs / Diagnostics

U7003: Escape budget exceeded

Release v0.4.0

A module uses checked more times than its budget allows. U7003 reports the first use beyond the budget, with the later uses as related locations.

Why Una rejects it

checked replaces a static proof with a runtime test, so each module may use it only as many times as [escape_budget] checked_per_module in una.toml, or from edition 0.4 checked per module in the escapes section of ita.una, allows. The default is 0, and a file checked on its own has the default (spec/06 §6).

How to fix it

Its repairs keep the proof first:

The repair at a glance

diff
  module demo

  kind ParseError = | Empty

  pub nonempty(raw: Text) -> Text
    fails ParseError
  =
-   checked(raw, raw.len > 0) else fail Empty
+   if raw.len > 0 then raw else fail Empty

Failing example

una
module demo

kind ParseError = | Empty

pub nonempty(raw: Text) -> Text
  fails ParseError
=
  checked(raw, raw.len > 0) else fail Empty

Fixed example

una
module demo

kind ParseError = | Empty

pub nonempty(raw: Text) -> Text
  fails ParseError
=
  if raw.len > 0 then raw else fail Empty