Skip to main content

EngineConstructionError

Enum EngineConstructionError 

Source
pub enum EngineConstructionError {
    RewriteCycle {
        axis: CategoryId,
        members: Box<[RewriteId]>,
    },
    UnannotatedCustomAxes {
        rewrite: RewriteId,
    },
    UnknownRuleOverride {
        key: String,
        did_you_mean: Option<String>,
    },
    ConflictingRuleOverride {
        rule_id: String,
        keys: Box<[String]>,
        severities: Box<[String]>,
    },
}
Expand description

Errors that will be raised while constructing an Engine.

Every variant is intended to be a hard failure — the Phase 3 Engine::new implementation will return Err rather than silently degrading. Runtime lint / fix never emits these; they are build-time configuration errors the integrator is expected to resolve before shipping.

Until that constructor path lands, this enum documents the planned engine-construction error surface for downstream tooling.

Variants§

§

RewriteCycle

A read/write cycle exists among the declared page rewrites.

axis is one category in the cycle (there may be several — the engine reports the first one it hits during the topological sort). members names every rewrite participating in the cycle.

The variable-length slice form (not [RewriteId; 2]) is deliberate: cycles of length ≥ 3 are a real failure mode — foundational-plan line 1066 notes the JOINT/FGI/REL-TO interaction as one that could plausibly trip this path if authored incorrectly.

The list is owned (Box<[RewriteId]>, not &'static [...]) because cycle membership is computed at engine-construction time from the declared rewrite graph, not borrowed from a static table. Owning it here avoids the memory-leak / lifetime-gymnastics tradeoff a 'static slice would force on the Phase 3 scheduler. RewriteId is itself &'static str, so the per-entry payload is still 'static; only the container is heap-allocated.

Fired by the Phase 3 scheduler when Engine::new runs Kahn’s algorithm over the rewrite graph (tasks T031–T032).

Fields

§members: Box<[RewriteId]>
§

UnannotatedCustomAxes

A PageRewrite::custom was declared without explicit reads / writes (or with empty slices).

The declarative constructor derives these from the variant shapes; custom uses function pointers so the engine cannot derive them. Failing closed forces the rewrite author to annotate the dataflow explicitly — an un-annotated custom rewrite could not be scheduled relative to other rewrites.

Fields

§rewrite: RewriteId
§

UnknownRuleOverride

A [rules] entry in the merged config references a key that is neither a known rule ID (e.g., E001) nor a known rule name (e.g., portion-mark-in-banner) across the registered rule sets.

key is the unknown string as the user wrote it. did_you_mean is a best-effort suggestion based on edit distance against the union of known IDs and names — None when no candidate is close enough to be useful.

Fired by Engine::new / Engine::with_clock when canonicalizing the config’s severity overrides against the registered rules. This is a user-config error, not an internal invariant violation; exit_code() maps it to EX_DATAERR (65).

Fields

§did_you_mean: Option<String>
§

ConflictingRuleOverride

The user specified the same rule two different ways in the merged config (e.g., E001 = "warn" and portion-mark-in-banner = "error") and the two entries resolved to different severity strings.

Duplicate forms with the same severity are silently accepted — only a genuine value conflict hard-fails.

rule_id is the canonical ID both keys resolved to. keys contains the two source keys as the user wrote them; severities contains the two conflicting severity strings, index-aligned with keys.

Fields

§rule_id: String
§keys: Box<[String]>
§severities: Box<[String]>

Implementations§

Source§

impl EngineConstructionError

Source

pub fn exit_code(&self) -> i32

Exit code for this error per contracts/cli.md.

  • UnknownRuleOverride / ConflictingRuleOverrideEX_DATAERR (65). These are user-config defects — the .marque.toml refers to a rule that doesn’t exist, or contradicts itself — and the user fixes them by editing their config.
  • RewriteCycle / UnannotatedCustomAxesEX_UNAVAILABLE (69). These are defects in the declarative scheme the engine was built against (developer / rule-author errors, not user-config errors), so the tool can’t honor the request until the developer ships a corrected build.

Trait Implementations§

Source§

impl Clone for EngineConstructionError

Source§

fn clone(&self) -> EngineConstructionError

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 EngineConstructionError

Source§

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

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

impl Display for EngineConstructionError

Source§

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

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

impl Error for EngineConstructionError

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

impl PartialEq for EngineConstructionError

Source§

fn eq(&self, other: &EngineConstructionError) -> 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 Eq for EngineConstructionError

Source§

impl StructuralPartialEq for EngineConstructionError

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

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> 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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> HostError for T
where T: Any + Error + Send + Sync + 'static,