pub enum RuntimeError {
Show 31 variants
VariableNotFound(String, TokenRange),
TypeMismatch {
expected: String,
found: String,
range: TokenRange,
},
ValidationError(String, TokenRange),
DivisionByZero(TokenRange),
FunctionNotFound(String, TokenRange),
CircularReference {
cycle: Vec<String>,
range: TokenRange,
},
UnsupportedOperator(String, TokenRange),
InvalidIdentifier(String, TokenRange),
IoError(String),
ModuleNotFound(String, SourceSpan),
ModuleParseError {
path: String,
message: String,
range: SourceSpan,
},
CircularImport(Vec<String>, SourceSpan),
NumericOverflow(TokenRange),
StepLimitExceeded {
limit: Option<u64>,
range: TokenRange,
},
RecursionLimitExceeded {
limit: usize,
range: TokenRange,
},
ValueTooLarge {
limit: usize,
actual: usize,
range: TokenRange,
},
IndexOutOfBounds {
range: TokenRange,
},
EmptyList {
range: TokenRange,
},
CapabilityDenied {
cap_bit: Option<u32>,
reason: String,
range: TokenRange,
},
NoMainSignature {
range: TokenRange,
},
MissingMainArg {
name: String,
range: TokenRange,
},
UnexpectedMainArg {
name: String,
range: TokenRange,
},
MainArgTypeMismatch {
name: String,
expected: String,
found: String,
range: TokenRange,
},
MainReturnTypeMismatch {
expected: String,
found: String,
range: TokenRange,
},
Unsupported {
reason: String,
},
RemoteImportFailed {
payload: Box<RemoteImportFailure>,
range: TokenRange,
},
RemoteImportDenied {
payload: Box<RemoteImportDenial>,
range: TokenRange,
},
RemoteImportHashMismatch {
payload: Box<RemoteImportHashMismatchDetail>,
range: TokenRange,
},
ImportHashMismatch {
payload: Box<ImportHashMismatchDetail>,
range: TokenRange,
},
ImportHashUnknownAlgorithm {
path: String,
algorithm: String,
range: TokenRange,
},
ImportHashInvalidHex {
path: String,
algorithm: String,
expected_len: usize,
got_len: usize,
range: TokenRange,
},
}Variants§
VariableNotFound(String, TokenRange)
TypeMismatch
ValidationError(String, TokenRange)
DivisionByZero(TokenRange)
FunctionNotFound(String, TokenRange)
CircularReference
Fields
range: TokenRangeUnsupportedOperator(String, TokenRange)
InvalidIdentifier(String, TokenRange)
IoError(String)
ModuleNotFound(String, SourceSpan)
ModuleParseError
CircularImport(Vec<String>, SourceSpan)
NumericOverflow(TokenRange)
StepLimitExceeded
Step / resource budget exhausted. The tree-walker fills limit
with the configured max_steps; the compiled backends
trap with the numeric tag only and leave limit as None.
Fields
limit: Option<u64>The max_steps budget that was crossed, when the denying
backend carries it (tree-walk). None on the compiled trap
path, which only knows that the budget was exceeded.
range: TokenRangeRecursionLimitExceeded
ValueTooLarge
IndexOutOfBounds
Phase 4.c-2: an index / range operation walked off the end of
a String / List receiver. Both backends share this variant —
the tree-walker raises it from xs[i] style accessors, the
wasm AOT path raises it from substring / similar stdlib
builders when the caller-supplied bounds exceed the
receiver’s length.
Fields
range: TokenRangeEmptyList
Phase 4.c-2: a reducer that requires at least one element
(list_int_max, future head / last, …) was called on
an empty list. Carries the call-site source range so the
diagnostic points at the offending expression rather than at
the stdlib body itself.
Fields
range: TokenRangeCapabilityDenied
A guarded native-fn / #import was denied because the host did
not grant a required capability. Produced by every backend: the
tree-walker fills a descriptive reason (and the bit, when it
has one); the compiled trap paths carry
only the numeric cap_bit and a generic reason.
Fields
cap_bit: Option<u32>Capability bit index that was denied, when the denying
backend carries it (compiled trap path; tree-walk native-fn
dispatch). None for FS-resolver denials that map to no
single bit, or when the compiled trap lost the bit.
reason: StringHuman-readable reason. Tree-walk fills the native-fn / import detail; compiled backends fill “host-fn requires capability bit N”.
range: TokenRangeNoMainSignature
Fields
range: TokenRangeMissingMainArg
UnexpectedMainArg
MainArgTypeMismatch
MainReturnTypeMismatch
Unsupported
Phase 8: the active backend cannot satisfy the requested
Evaluator method. The wasm-AOT backend uses this to refuse
eval / eval_root / force_thunk / invoke_closure because
its AST is consumed at compile time and the runtime only knows
how to drive the precompiled run_main entry. Host-side hooks
that depend on lazy / first-class-closure semantics need to
either switch to the tree-walker or be reformulated.
Fields
RemoteImportFailed
v3+ a-3: remote #import "https://..." resolved an URL but the
HTTP fetch (DNS / connect / TLS / non-2xx status / body read)
failed. The payload is boxed so the variant does not bloat the
RuntimeError enum past clippy’s result_large_err threshold —
callers should use the url() / cause() accessors below, or
destructure *payload.
RemoteImportDenied
v3+ a-3: remote #import "https://..." was rejected before the
fetch ran because the active sandbox forbids network egress
(no --trust / no Capabilities::network).
RemoteImportHashMismatch
v3+ a-3: an explicit integrity hash was supplied alongside a
remote #import, and the fetched body’s sha256 did not match.
The pinning syntax itself is not wired in this phase, but
the variant ships so future syntax work (or an out-of-band
lockfile) can reuse the error surface without churning the
enum.
ImportHashMismatch
review-improvement-174 (v3++ b-2 fix): the evaluator’s #import
path computed the loaded module body’s digest and it did not match
the inline sha256:"..." integrity pin written on the directive.
Distinct from Self::RemoteImportHashMismatch so operators can
tell apart “remote fetch produced an unexpected body” (caught by
RemoteHttpResolver / analyzer) from “evaluator was handed a
pre-resolved module body that disagrees with its pin” — the latter
is the analyzer-bypass attack vector this fix closes.
ImportHashUnknownAlgorithm
review-improvement-174: the inline pin on a #import carried an
algorithm identifier (<algo>:"...") the evaluator does not know
how to compute. The analyzer surfaces the same condition as a
WorkspaceDiagnostic::ImportHashUnknownAlgorithm; this variant
mirrors it for the analyzer-bypass path so the evaluator never
silently treats an unknown algorithm as “no pin”.
ImportHashInvalidHex
review-improvement-174: the inline pin hex was malformed (wrong
length, non-hex character). Mirrors the analyzer’s
WorkspaceDiagnostic::ImportHashInvalidHex for the
evaluator-direct path; a malformed pin is rejected fail-closed
because we cannot compare against gibberish.
Trait Implementations§
Source§impl Clone for RuntimeError
impl Clone for RuntimeError
Source§fn clone(&self) -> RuntimeError
fn clone(&self) -> RuntimeError
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for RuntimeError
impl Debug for RuntimeError
Source§impl Diagnostic for RuntimeError
impl Diagnostic for RuntimeError
Source§fn code(&self) -> Option<Box<dyn Display + '_>>
fn code(&self) -> Option<Box<dyn Display + '_>>
Diagnostic. Ideally also globally unique, and documented
in the toplevel crate’s documentation for easy searching. Rust path
format (foo::bar::baz) is recommended, but more classic codes like
E0123 or enums will work just fine.Source§fn help(&self) -> Option<Box<dyn Display + '_>>
fn help(&self) -> Option<Box<dyn Display + '_>>
Diagnostic. Do you have any
advice for the poor soul who’s just run into this issue?Source§fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
fn labels(&self) -> Option<Box<dyn Iterator<Item = LabeledSpan> + '_>>
Diagnostic’s Diagnostic::source_codeSource§fn severity(&self) -> Option<Severity>
fn severity(&self) -> Option<Severity>
ReportHandlers to change the display format
of this diagnostic. Read moreSource§fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>
Diagnostic.Source§fn source_code(&self) -> Option<&dyn SourceCode>
fn source_code(&self) -> Option<&dyn SourceCode>
Diagnostic’s Diagnostic::labels to.Diagnostics.Source§fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
fn diagnostic_source(&self) -> Option<&dyn Diagnostic>
Source§impl Display for RuntimeError
impl Display for RuntimeError
Source§impl Error for RuntimeError
impl Error for RuntimeError
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()
Auto Trait Implementations§
impl Freeze for RuntimeError
impl RefUnwindSafe for RuntimeError
impl Send for RuntimeError
impl Sync for RuntimeError
impl Unpin for RuntimeError
impl UnsafeUnpin for RuntimeError
impl UnwindSafe for RuntimeError
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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more