pub enum Fault {
Show 13 variants
DivideByZero,
RegisterOutOfRange {
reg: u8,
frame_size: u8,
},
RegisterIndexOverflow {
base: u8,
offset: 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),
NativeDenied(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
crate::scheduler::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
crate::FlowOutcome::Failed and is handed to the Flow’s supervisor, which
decides whether to restart it (design notes §15-16).
Variants§
DivideByZero
RegisterOutOfRange
RegisterIndexOverflow
An instruction’s register operand plus the offset it gathers at does
not fit the register index space at all — e.g. Spawn a=255, which
reads its arguments from a+1...
Distinct from Fault::RegisterOutOfRange, which is about an index
that is perfectly representable and merely absent from this frame.
Kept separate so the fault cannot lie: reporting “register 255 is out
of range” for a request that was really for register 256 would send
whoever reads it looking in the wrong place.
BadConstant
BadFunction
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.
TypeMismatch
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.
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. Host-side native refused the call (FFI error string).
NativeDenied(String)
S7: CALL_NATIVE failed the allowlist / NATIVE-right / revocation check before the function pointer was touched.
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§
impl Eq for Fault
Source§impl Error for Fault
impl Error for Fault
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl From<Fault> for SpawnError
impl From<Fault> for SpawnError
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.