Skip to main content

FaultKind

Enum FaultKind 

Source
#[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).

Trait Implementations§

Source§

impl Clone for FaultKind

Source§

fn clone(&self) -> FaultKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for FaultKind

Source§

impl Debug for FaultKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for FaultKind

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for FaultKind

Source§

impl PartialEq for FaultKind

Source§

fn eq(&self, other: &FaultKind) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for FaultKind

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.