Skip to main content

RefEvalError

Enum RefEvalError 

Source
pub enum RefEvalError {
    Ineligible(Vec<Boundary>),
    MissingRelation(String),
    RelationArityMismatch {
        predicate: String,
        atom_arity: usize,
        relation_arity: usize,
    },
    RelationRowArityMismatch {
        predicate: String,
        row_index: usize,
        row_len: usize,
        schema_len: usize,
    },
    RelationValueTypeMismatch {
        predicate: String,
        row_index: usize,
        column: usize,
        expected: ScalarType,
        got: String,
    },
    ConstantTypeMismatch {
        predicate: String,
        position: usize,
        expected: ScalarType,
        got: String,
    },
    ComparisonTypeMismatch {
        left: String,
        right: String,
        op: CompOp,
    },
    UnboundHeadVariable(String),
    IsExprNotSupported,
    ConflictingVariableType {
        var: String,
        first_predicate: String,
        first_position: usize,
        first_type: ScalarType,
        second_predicate: String,
        second_position: usize,
        second_type: ScalarType,
    },
    InferenceConflict {
        predicate: String,
        column: usize,
        first_rule_index: usize,
        first_type: ScalarType,
        second_rule_index: usize,
        second_type: ScalarType,
    },
}
Expand description

Errors surfaced by evaluate_rule.

Variants§

§

Ineligible(Vec<Boundary>)

The rule was Eligibility::Ineligible — callers must gate on super::analyze / super::analyze_typed before evaluation. Carries the boundary list for diagnostic use.

§

MissingRelation(String)

A predicate referenced by the rule body was not present in the supplied RefRelationStore.

§

RelationArityMismatch

A body atom’s arity does not match the supplied relation’s schema arity. The evaluator is the WCOJ correctness oracle — arity drift between rule and fixture must surface as a loud failure, not a silent skip.

Fields

§predicate: String

Predicate name being looked up.

§atom_arity: usize

Number of terms in the body atom.

§relation_arity: usize

Number of columns in the relation schema.

§

RelationRowArityMismatch

A relation row’s length does not equal the schema’s column count. Rejected before evaluation begins so a malformed fixture fails on entry rather than producing misleading partial-row matches.

Fields

§predicate: String

Predicate name owning the malformed row.

§row_index: usize

Index of the offending row within the relation.

§row_len: usize

Observed length of the row.

§schema_len: usize

Expected length per the schema.

§

RelationValueTypeMismatch

A relation row carries a RefValue whose variant does not match the schema’s [ScalarType] at that column. Detected before evaluation so type drift in fixtures fails loudly rather than silently corrupting GPU oracle comparisons.

Fields

§predicate: String

Predicate name owning the malformed row.

§row_index: usize

Row index within the relation.

§column: usize

Column index within the row.

§expected: ScalarType

Schema-declared type at that column.

§got: String

String description of the actual value.

§

ConstantTypeMismatch

A constant in a body atom could not be coerced to a value compatible with the relation’s column type at that position.

Fields

§predicate: String

Predicate name where the mismatch occurred.

§position: usize

Argument position (0-based) within the predicate.

§expected: ScalarType

Expected scalar type per the relation’s schema.

§got: String

String description of the constant for diagnostic use.

§

ComparisonTypeMismatch

A Comparison body literal could not be evaluated because its operands were of incompatible types.

Fields

§left: String

Left-hand operand description.

§right: String

Right-hand operand description.

§op: CompOp

Operator that was being applied.

§

UnboundHeadVariable(String)

The rule head referenced a variable that is not bound by any body atom (a free variable in the head).

§

IsExprNotSupported

The rule body contained an crate::ast::IsExpr — PR 2 rejects rules containing computed bindings via the BodyIsExpr boundary, so this is a defensive arm; if it fires the analyzer let an IsExpr rule through erroneously.

§

ConflictingVariableType

A variable appears in two body atoms whose relation schemas disagree on the column type at the variable’s position.

Detected by super::evaluate_rule_typed (and the typed fixpoint variants) at the typed-gate phase, before evaluation. Without this check, an evaluator would either silently coerce values across types or fail later with a less precise error pointing at a row, not at the rule.

The two (predicate, position, type) triples are recorded in first-encountered order: walking body atoms in source order, the first atom that types this variable wins first_*; the second atom whose type differs gets second_*. Subsequent agreeing atoms are silent.

Fields

§var: String

Variable name as it appears in the source rule.

§first_predicate: String

Predicate of the first atom that typed var.

§first_position: usize

0-based argument position within first_predicate.

§first_type: ScalarType

Schema type at (first_predicate, first_position).

§second_predicate: String

Predicate of the conflicting atom.

§second_position: usize

0-based argument position within second_predicate.

§second_type: ScalarType

Schema type at (second_predicate, second_position).

§

InferenceConflict

Two rules contributing to the same head predicate disagree on the type of the same column under the PR 8 SCC type inference pass.

Distinct from Self::ConflictingVariableType, which is a within-rule body conflict (one rule, two body atoms typing the same variable differently). This variant is a cross-rule head-column conflict, detected by super::infer_scc_predicate_schemas when back-propagating from rule heads to head-predicate column types.

Surfaced through the typed evaluators via super::FixpointError::RuleEval / super::SccFixpointError::RuleEval; their rule_index field carries second_rule_index (the rule whose typing caused the conflict to be detected; the first rule’s typing was already accepted by then).

Fields

§predicate: String

Head predicate name where the conflict was detected.

§column: usize

0-based column index where types disagree.

§first_rule_index: usize

Rule index (within the predicate’s group) that first typed the column.

§first_type: ScalarType

Type derived from the first rule’s body.

§second_rule_index: usize

Rule index (within the predicate’s group) that disagrees.

§second_type: ScalarType

Type derived from the conflicting rule’s body.

Trait Implementations§

Source§

impl Clone for RefEvalError

Source§

fn clone(&self) -> RefEvalError

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RefEvalError

Source§

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

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

impl PartialEq for RefEvalError

Source§

fn eq(&self, other: &RefEvalError) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RefEvalError

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> 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, 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.
§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,