pub struct ExprError {
pub message: String,
}Expand description
An expression representing an unreachable branch.
Expr::Error marks code paths that should never execute at runtime. The
primary use is the else branch of ExprMatch on enum discriminants: all
valid discriminants are covered by explicit arms, so the else branch is
semantically unreachable. If it IS reached (e.g., due to data corruption or
a schema mismatch), evaluation fails with the contained message.
§Simplifier semantics
Because Error is unreachable, simplification rules treat it as an opaque value — no special propagation is needed. Existing rules handle it naturally:
false AND (Error == x)→false(short-circuit onfalse)Record([disc, Error]) == Record([I64(1), "alice"])decomposes intodisc == I64(1) AND Error == "alice", and ifdisc == I64(1)contradicts a guard likedisc != I64(1), the whole AND folds tofalse.
In all well-formed cases, the guard constraints around Error cause the branch to be pruned without requiring Error-specific rules.
§Type inference
Expr::Error infers as Type::Unknown. TypeUnion::insert skips
Unknown, so an Error branch doesn’t widen inferred type unions.
Fields§
§message: StringThe error message to surface if this expression is evaluated.