Skip to main content

Fault

Enum Fault 

Source
pub enum Fault {
    DivideByZero,
    RegisterOutOfRange {
        reg: u8,
        frame_size: u8,
    },
    BadConstant {
        index: u32,
        pool_size: u32,
    },
    BadFunction {
        index: u32,
        table_size: u32,
    },
    BadOpcodeByte(u8),
    CallStackOverflow {
        depth: usize,
    },
    TypeMismatch {
        expected: &'static str,
        got: &'static str,
    },
    BadNative {
        index: u32,
        table_size: u32,
    },
    NativeError(String),
    Explicit(i32),
    Invariant(&'static str),
}
Expand description

Anything that can go wrong inside a running Flow’s VM.

A Fault is never a Rust panic — panics are reserved for genuine host bugs and are caught at the worker boundary (see byteflow-scheduler::worker::run_worker) precisely so that one Flow’s bug (division by zero, a corrupt jump target that slipped past the verifier, an out-of-range register) can never take down a worker thread, let alone the whole runtime. A Fault instead becomes FlowState::Failed and is handed to the Flow’s supervisor, which decides whether to restart it (design notes §15-16).

Variants§

§

DivideByZero

§

RegisterOutOfRange

Fields

§reg: u8
§frame_size: u8
§

BadConstant

Fields

§index: u32
§pool_size: u32
§

BadFunction

Fields

§index: u32
§table_size: u32
§

BadOpcodeByte(u8)

§

CallStackOverflow

Function call nesting exceeded Vm::MAX_CALL_DEPTH. Bytecode has no native stack overflow (frames are heap-allocated Vec<Value>s), so this is a deliberate, checked limit rather than a segfault.

Fields

§depth: usize
§

TypeMismatch

Fields

§expected: &'static str
§got: &'static str
§

BadNative

CallNative referenced a slot outside the runtime’s registered native function table (design notes §30-31). Distinct from BadFunction, which is about the bytecode function table baked into the chunk — natives are supplied by the embedder at Vm construction time and can’t be range-checked by crate::bytecode::verify, which has no visibility into them.

Fields

§index: u32
§table_size: u32
§

NativeError(String)

A native function returned an error (host-side failure — I/O, invalid argument the Rust side rejected, capability denied, etc). The message is native-function-defined.

§

Explicit(i32)

Explicit Trap opcode, e.g. an assertion emitted by a compiler.

§

Invariant(&'static str)

Broken VM invariant (e.g. empty frame stack while running). Category D in the error model — surfaced as a Flow fault, never as unwrap.

Trait Implementations§

Source§

impl Clone for Fault

Source§

fn clone(&self) -> Fault

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 Debug for Fault

Source§

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

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

impl Display for Fault

Source§

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

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

impl Error for Fault

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<Fault> for SpawnError

Source§

fn from(fault: Fault) -> Self

Converts to this type from the input type.
Source§

impl PartialEq for Fault

Source§

fn eq(&self, other: &Fault) -> 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 Fault

Auto Trait Implementations§

§

impl Freeze for Fault

§

impl RefUnwindSafe for Fault

§

impl Send for Fault

§

impl Sync for Fault

§

impl Unpin for Fault

§

impl UnsafeUnpin for Fault

§

impl UnwindSafe for Fault

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<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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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 = !

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.