Skip to main content

RuntimeError

Enum RuntimeError 

Source
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

Fields

§expected: String
§found: String
§

ValidationError(String, TokenRange)

§

DivisionByZero(TokenRange)

§

FunctionNotFound(String, TokenRange)

§

CircularReference

Fields

§cycle: Vec<String>

Path segments that form the cycle, in declaration order.

§

UnsupportedOperator(String, TokenRange)

§

InvalidIdentifier(String, TokenRange)

§

IoError(String)

§

ModuleNotFound(String, SourceSpan)

§

ModuleParseError

Fields

§path: String
§message: String
§

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.

§

RecursionLimitExceeded

Fields

§limit: usize
§

ValueTooLarge

Fields

§limit: usize
§actual: usize
§

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

§

EmptyList

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

§

CapabilityDenied

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: String

Human-readable reason. Tree-walk fills the native-fn / import detail; compiled backends fill “host-fn requires capability bit N”.

§

NoMainSignature

Fields

§

MissingMainArg

Fields

§name: String
§

UnexpectedMainArg

Fields

§name: String
§

MainArgTypeMismatch

Fields

§name: String
§expected: String
§found: String
§

MainReturnTypeMismatch

Fields

§expected: String
§found: String
§

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

§reason: String

Human-readable explanation of why the backend cannot honour the call. Free-form so each backend can describe its own constraint (e.g. “wasm-aot has no AST at runtime”).

§

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.

Fields

§

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).

Fields

§

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”.

Fields

§path: String
§algorithm: String
§

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.

Fields

§path: String
§algorithm: String
§expected_len: usize
§got_len: usize

Trait Implementations§

Source§

impl Clone for RuntimeError

Source§

fn clone(&self) -> RuntimeError

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 RuntimeError

Source§

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

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

impl Diagnostic for RuntimeError

Source§

fn code(&self) -> Option<Box<dyn Display + '_>>

Unique diagnostic code that can be used to look up more information about this 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 + '_>>

Additional help text related to this 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> + '_>>

Labels to apply to this Diagnostic’s Diagnostic::source_code
Source§

fn severity(&self) -> Option<Severity>

Diagnostic severity. This may be used by ReportHandlers to change the display format of this diagnostic. Read more
Source§

fn url<'a>(&'a self) -> Option<Box<dyn Display + 'a>>

URL to visit for a more detailed explanation/help about this Diagnostic.
Source§

fn source_code(&self) -> Option<&dyn SourceCode>

Source code to apply this Diagnostic’s Diagnostic::labels to.
Source§

fn related<'a>( &'a self, ) -> Option<Box<dyn Iterator<Item = &'a dyn Diagnostic> + 'a>>

Additional related Diagnostics.
Source§

fn diagnostic_source(&self) -> Option<&dyn Diagnostic>

The cause of the error.
Source§

impl Display for RuntimeError

Source§

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

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

impl Error for RuntimeError

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

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

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
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> Same for T

Source§

type Output = T

Should always be Self
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.