#[repr(C)]pub enum FaultKind {
Show 16 variants
None = 0,
IntOverflow = 1,
DivByZero = 2,
IndexOutOfBounds = 3,
ParseFailed = 4,
EmptyCollection = 5,
StackOverflow = 6,
FloatToInt = 7,
InvalidChar = 8,
InvalidText = 9,
InvalidSize = 10,
TypeMismatch = 11,
Panic = 12,
AssertFailed = 13,
EmptyRange = 14,
NoAnswer = 15,
}Expand description
What kind of runtime fault occurred (§9.2, §10.4). Set by the runtime wrapper that detected it; read by the host after the generated code unwinds to its fault epilogue.
Variants§
None = 0
No fault pending. The zero state.
IntOverflow = 1
Integer arithmetic overflowed (§4.12).
DivByZero = 2
Division or remainder by zero (§4.12).
IndexOutOfBounds = 3
A collection index was out of bounds (§9.2). Raised by Vec.get /
indexing and similar accessors.
ParseFailed = 4
An input parse mismatch (§7.11). Raised by the input-parser interpreter
when the input does not match a parser expression. The interpreter also
records the deepest mismatch in the runtime’s crate::ParseDetail
slot, which the host reads to render the input/parser spans.
EmptyCollection = 5
An operation required a non-empty collection but found an empty one
(§9.2). Raised by Deque.pop_front/pop_back, heap pop/peek, and
similar accessors on an empty collection.
StackOverflow = 6
Recursion exhausted the native-stack budget (§9.2, §17.4). Raised by the
prologue guard in every generated function when stack_left is less than
this frame’s frame_cost, so the host survives deep recursion
(count(100000) and similar) instead of overflowing the native stack and
aborting (SIGABRT).
FloatToInt = 7
A Float value could not be converted to Int: NaN, ±infinity, or a
finite value outside the signed 64-bit range (§4.12). Float arithmetic
itself never faults (per IEEE-754 it produces inf/nan); only the
narrowing to_int conversion does.
InvalidChar = 8
A code point was not a Unicode scalar value: negative, above
0x10FFFF, or in the surrogate range D800..=DFFF (§4.3). Raised by
praxis_alloc_char.
InvalidText = 9
Host input that had to be Text was not valid UTF-8 (§4.3). Raised by
praxis_get_input, which is its only producer (ADR-111).
The validation sits at the one caller holding bytes it did not author. A
Text literal’s bytes come from a Rust String and cannot fail, so
its Alloc is non-faulting, and a violated precondition in
praxis_alloc_text aborts rather than faulting, the way
praxis_int_load’s does.
Generated code reads FaultKind directly since ADR-102, so renumbering
a variant is an ABI change and not a tidy-up. This one is unreachable
from praxis run, whose lazy_stdin::read validates stdin and exits 2
— it exists for an embedder that does not.
InvalidSize = 10
A size or extent the runtime cannot honour: a negative Grid width or
height, a width * height that overflows or exceeds
GridExtent::MAX_CELLS, or
a BitSet member outside BitIndex’s range
(§9.2). Each is checked before the usize cast, where a negative
extent would otherwise land near usize::MAX and become an OOM abort or
a capacity-overflow panic across extern "C".
TypeMismatch = 11
A value did not have the type its destination declared: pushing a
Float into a Vec[Int], or constructing a Grid[T] whose cell type
has no default value to fill with (§9.2).
Panic = 12
The program called panic(value) (§9.1). The value it passed is
rendered through its descriptor into the runtime’s FaultMessage
slot, so the fault says what the program stopped for.
AssertFailed = 13
An assert(condition) found its condition false (§9.1). Carries no
message: assert takes a condition and nothing else, so any text would
only restate the kind. panic is the name that carries words.
EmptyRange = 14
A range with no members was asked for a member: clamp(v, low, high)
with low > high (ADR-058), which names an empty inclusive range and so
has no value to clamp to.
praxis_range_len’s uncountable range is deliberately not this kind:
it raises IntOverflow, because Int::MIN..Int::MAX
is the fullest range there is and calling it empty would be a fault
message that lies (ADR-059, ADR-075).
NoAnswer = 15
An argument this algorithm has no answer for: a negative edge weight in
the Dijkstra and A* searches, whose settle-once-and-never-reconsider
shape makes a negative edge silently overstate the answer, and a
negative heuristic, which makes f = g + h decrease along a path
(ADR-060).
The operand is well-formed and the graph is well-formed; what is absent
is a correct answer this algorithm could produce, which is why neither
InvalidSize nor
TypeMismatch fits: an answer the walk cannot
compute is a fault, not a wrong number (ADR-060).