pub enum CompileError {
Show 22 variants
UnsupportedConstruct {
construct: &'static str,
evaluator: &'static str,
detail: String,
},
DoublyDefinedUnknown {
name: String,
differential: String,
algebraic: String,
},
CompilerRefusedRule {
compiler: &'static str,
kind: &'static str,
rule: String,
tier: &'static str,
reason: String,
},
UnsupportedFeatureError {
feature: String,
message: String,
},
UnsupportedDimensionalityError {
independent_variables: Vec<String>,
},
InterpreterBuildError {
details: String,
},
UnloweredOperatorError {
op: String,
},
InvalidOperatorArity {
op: String,
got: usize,
expected: String,
},
MakearrayRegionInvalid {
reason: String,
},
InvalidBroadcastFn {
reason: String,
},
UnevaluableOperatorError {
op: String,
},
ValueInventionRefused {
code: &'static str,
reason: String,
},
TableLookupLowering {
code: &'static str,
reason: String,
},
UnsupportedElementType {
element_type: String,
},
Float32Unsupported {
construct: String,
reason: String,
},
ElementTypeUncarried {
construct: String,
reason: String,
},
MixedElementType {
op: String,
lhs_name: String,
lhs_type: String,
rhs_name: String,
rhs_type: String,
},
UnalignableArrayShape {
operand: String,
axis: String,
result: String,
result_axes: Vec<String>,
},
ObservedCycle {
cycle: Vec<String>,
},
MissingData {
parameter: String,
detail: String,
},
MissingInitialValue {
slot: String,
detail: String,
},
Flatten(FlattenError),
}Expand description
Errors raised when building a compiled model from a flattened system.
Variants§
UnsupportedConstruct
A model construct this evaluator cannot run: a continuous or discrete
event, an implicit equation (an equation whose LHS is an expression
rather than an unknown, D(unknown) or ic(unknown)), or a Wiener-noise
parameter. esm-spec §9.6.6
unsupported_construct.
Refused at build rather than skipped: a model run without its event, or without its residual solved, reports a wrong answer, and nothing in that answer says a construct was dropped.
Fields
DoublyDefinedUnknown
One unknown carries BOTH a derivative equation and a bare-LHS one
(esm-spec §4.9.4 equation_count_mismatch).
§4.9.4 counts an equation against the unknowns “whichever form its LHS
takes”, so D(x) ~ f beside x ~ g is two equations binding one
unknown: the document is unbalanced, and validate reports exactly
that. This crate used to tie-break in favour of the derivative, which
integrates a system free of a constraint the file declares and reports
the trajectory as the answer. The build is the other place that same
document arrives, so it refuses under the same code.
Fields
CompilerRefusedRule
The chosen compiler cannot run one of this document’s rules
(esm-spec §9.6.6 compiler_refused_rule, esm-libraries-spec §2.5.10).
Raised at CONSTRUCTION, naming the compiler, the rule — an equation or an observed, component-qualified — the cadence tier the rule would have run at, and the DEEPEST decline reason reached while trying to lower it. A refusal, never a fallback: the compiler does not run that rule on a slower path, because a caller who asked for a compiled program and got a tree walk has no way to find that out.
Fields
UnsupportedFeatureError
The flattened system contains a feature the v1 simulator does not support (e.g. a join over data-derived columns).
Fields
UnsupportedDimensionalityError
The flattened system still carries a spatial independent variable — a
spatial operator that was never discretized into a faq stencil.
Discretized PDEs fold their spatial axis into array dimensions, leaving
independent_variables == ["t"], and simulate fine.
InterpreterBuildError
The interpreter could not build a callable representation of the flattened equations.
UnloweredOperatorError
A rewrite-target operator (a spatial / right-hand-side D, or the
optional sugar ops grad / div / laplacian / …) survived the
lowering fixpoint into an evaluation position (esm-spec §4.2 / §9.6.8).
Such ops carry NO evaluator: a discretization match rewrite rule MUST
lower them to a faq / makearray stencil before evaluation.
The gate fires here — before evaluation, not at load — with the uniform
unlowered_operator code that supersedes the former per-binding
UnreachableSpatialOperatorError / UnsupportedDimensionality errors.
Silently producing zeros (the previous behavior) would mask a broken
pipeline. This format ships no discretization rules — they live in
EarthSciDiscretizations.
InvalidOperatorArity
An evaluable-core operator (esm-spec §4.2) applied to the wrong number
of arguments — e.g. atan2 with one argument, or min with fewer than
two. The schema cannot express per-operator arity (args is
minItems: 0), so this is the gate that keeps a malformed-but-
schema-valid node out of the evaluators, where it would otherwise either
panic on an out-of-bounds index or — worse — be silently assigned two
different values by the per-cell oracle and the vectorized overlay.
See [crate::op_registry].
Fields
MakearrayRegionInvalid
A makearray node whose regions are malformed: either the regions
disagree on rank (a ragged regions list), or a bound pair is inverted
beyond the legal empty spelling. Per esm-spec §4.3.2 a pair with
stop == start - 1 is the canonical empty region and is legal;
anything further inverted (stop < start - 1) is rejected with
makearray_region_inverted.
InvalidBroadcastFn
A broadcast node whose fn field is absent or does not name a scalar
operator (esm-spec §4.3.4). broadcast is the one op whose OPERATOR is
data — the node says broadcast, the arithmetic is named by a sibling
string — and nothing used to check that string, so a typo’d or missing
fn was silently evaluated as + (issue #101).
UnevaluableOperatorError
An evaluable-core operator (esm-spec §4.2) that this interpreter has no evaluation rule for reached the evaluator.
These ops are legal in an AST but are eliminated before the per-cell
evaluator ever runs: the build-time query ops (skolem, rank,
distinct, argmin, argmax) are resolved by
[crate::value_invention], and the form/lowering ops (ic, true,
enum, table_lookup, apply_expression_template) are consumed by
their respective lowering passes. One arriving at the evaluator means the
pipeline is broken.
It is reported rather than evaluated to a NaN sentinel: a silent NaN is indistinguishable from a legitimate numerical result and would propagate into the solution, whereas the pipeline stage that should have eliminated the op is the actual defect.
Raised by the array runtime’s build gate and by the single-expression
crate::expression::evaluate, whose scalar bindings additionally give
the array / tensor and geometry ops no value. The invariant is the same
either way: an unevaluable op is a diagnostic, never a number.
ValueInventionRefused
An expression ranges over a kind: "derived" index set whose
value-invention producer could not be materialized at build (esm-spec
§4.2 / §9.6.6). Refused rather than contracted as an empty range, which
folds to the additive identity and reads as a plausible 0.
Fields
TableLookupLowering
A table_lookup node that cannot be lowered to its esm-spec §9.5.3
interp.linear / interp.bilinear / index form — an unknown table,
an axis-key set that does not match the table’s declared axes, an
out-of-range output, or a table whose interpolation and axis count
disagree.
Raised by [crate::lower_table_lookup] during the build rather than by
the evaluator: unevaluable_operator would name table_lookup without
saying which of the §9.5.5 conditions the document actually trips.
Fields
UnsupportedElementType
domain.element_type names a precision this evaluator does not have.
Reported rather than defaulted to binary64: a document that asks for a
precision and silently gets a different one is the same class of defect
as an element_type that is accepted and then ignored.
Float32Unsupported
A construct that cannot be evaluated in binary32 appears in a document
declaring domain.element_type: "Float32".
The alternative — evaluating just that construct in binary64 — is a silent fallback: the document asked for one precision and part of the answer would be computed in another, with nothing in the result to say which part. So it is an error naming the construct.
Fields
ElementTypeUncarried
A declared working precision reaches a construct this evaluator cannot carry it through (esm-spec §11.3.1, §4.7 “Working precision crosses a mount”).
Refused rather than evaluated in another precision: the declaration would otherwise be accepted and ignored.
Fields
MixedElementType
One operator’s operands carry DIFFERENT declared element types
(ModelVariable.element_type, esm-spec §11.3.1).
Refused rather than resolved by a usual-arithmetic-conversions rule,
because every resolution is a silent answer to a question only the
author can settle. Widening to the wider operand makes a quantity
declared binary32 come out binary64 — the declaration ignored, with
nothing in the result to say so. Narrowing to the narrower destroys the
binary64 operand, which is the very corruption per-variable element
types exist to prevent (a ten-digit key rounded to binary32 collides
with its neighbours). So the mix is an error naming both variables, and
the author states the intent by computing the mixed step into a variable
whose own element_type says which precision it is in.
Fields
UnalignableArrayShape
A BARE array-level expression whose operand is declared over an index set the result does not have (esm-spec §4.3.4).
Operands of an array-level expression align by index-set NAME: an
operand declared over a SUBSET of the result’s index sets broadcasts
along the ones it is missing. An operand carrying an index set the
result does not carry has no axis to align to and no defensible value to
take, so it is rejected rather than reinterpreted positionally — the
positional flatten this replaces produced plausible, non-NaN,
zero-padded garbage (issue #100).
The shapes are fully known statically, so validate() reports the same
defect as an array_shape_mismatch structural error before any build is
attempted; this is the build-time backstop for a model compiled without
being validated first.
Fields
ObservedCycle
A dependency cycle among the model’s OBSERVED unknowns (esm-spec §4.9.6): each observed on the cycle is defined by an equation whose RHS names the next, so no evaluation order satisfies every definition.
The equations decide this on their own, so validate() reports the same
defect as an observed_cycle structural error before any build is
attempted; this is the build-time backstop for a model compiled without
being validated first — and it is the reason this variant exists at all.
The ordering sweep used to tolerate an unorderable rule set, appending
the stuck rules in declaration order so “the build still proceeds”; what
actually proceeded was a materialization pass that read an observed with
no value yet and reported E_TREEWALK_UNBOUND_NAME against whichever
name it reached first — routinely an observed that is declared, defined
and referenced perfectly well (issue #181).
Fields
MissingData
A shaped parameter reached construction with no value: no default, no
caller array, and — for one the document refreshes from a data source
or a registered handler — no provider data either. esm-spec §10.10 makes
“a parameter with neither a default nor a supplied value” an error when
a problem is built. detail names what the document says feeds the
parameter and how a caller supplies it.
Fields
MissingInitialValue
An unknown that needs a starting value reached construction with none:
no default, no initial condition or ic equation, and no caller u0
(esm-spec §11.4).
Fields
Flatten(FlattenError)
The convenience constructors flattened the input first; that step failed.
Implementations§
Source§impl CompileError
impl CompileError
Sourcepub fn build_err(details: impl Into<String>) -> Self
pub fn build_err(details: impl Into<String>) -> Self
Shorthand constructor for CompileError::InterpreterBuildError, the
catch-all build failure, whose { details: format!(…) } spelling is
otherwise repeated at every raise site.
Trait Implementations§
Source§impl Debug for CompileError
impl Debug for CompileError
Source§impl Display for CompileError
impl Display for CompileError
Source§impl Error for CompileError
impl Error for CompileError
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<CompileError> for SimulateError
impl From<CompileError> for SimulateError
Source§fn from(source: CompileError) -> Self
fn from(source: CompileError) -> Self
Source§impl From<FlattenError> for CompileError
impl From<FlattenError> for CompileError
Source§fn from(source: FlattenError) -> Self
fn from(source: FlattenError) -> Self
Auto Trait Implementations§
impl Freeze for CompileError
impl RefUnwindSafe for CompileError
impl Send for CompileError
impl Sync for CompileError
impl Unpin for CompileError
impl UnsafeUnpin for CompileError
impl UnwindSafe for CompileError
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T> DistributionExt for Twhere
T: ?Sized,
impl<T, U> Imply<T> for U
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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.