pub enum ExitTier {
Analysis,
Build,
}Expand description
Which exit status a hard failure carrying this code ends the run with.
The question this answers, and the only question it answers: when this code is what stopped the run, does the process exit 2 or 3?
ExitTier::Analysis— exit 2. The compiler did its job and the CONTENT is the defect: a quest nothing can reach, a room too dark to read, a wave larger than the room it spawns in. The author fixes a campaign document or a prefab; nothing about the engine is wrong.ExitTier::Build— exit 3. The compiler could not produce a tree it is willing to stand behind: geometry, navigation, the solver, the emitted call graph.
§Why it lives on the code and not at the call site
The tier is a property of the RULE — DW0210 is an analysis-tier refusal
wherever it is raised — and it was nonetheless re-derived from the code’s
SPELLING at three separate places in delvec’s main, each a copy of
code.id().starts_with("DW02") || code == … with three named exceptions
appended. Three copies of a rule is three chances to update two of them, and
the spelling is not the rule: DW0312, DW0313 and DW0342 are
analysis-tier codes whose numbers say otherwise, which is exactly why the
exceptions had to be written out by hand in the first place.
§What a code that never stops a build declares
Most codes are reported as a Diagnostic among their phase’s findings, and
the PHASE decides the exit (validate exits 1, analyze exits 2). Such a
code declares ExitTier::Build, and that is a statement rather than a
placeholder: it says that IF this rule ever refuses with a build under way,
it stops the build. That is precisely what the string-prefix predicate did
for every code it did not recognise, so the declaration is the behaviour,
written down where the rule is.
There is no Default and no constructor that leaves it unsaid — a new
code cannot be added without answering.
Variants§
Analysis
Exit 2: the content is the defect, not the build.
Build
Exit 3: the compiler could not produce a tree.