pub enum ContractViolation {
UnboundImport {
import: String,
site: SourceContext,
},
FinalShadow {
export: String,
site: SourceContext,
},
DuplicateChild {
name: ChildName,
prior_site: Box<SourceContext>,
this_site: SourceContext,
},
Compile(String),
StrictNonePropagation {
bindings: Vec<String>,
site: SourceContext,
},
Bind(Arc<KernelError>),
}Expand description
Contract violation surfaced at finalize or spawn.
Variants per the cross-binding rules plus the umbrella
Self::Compile for errors raised by the Polydat compiler when
the body fragment is converted into a program (typically an
unbound identifier in the body, which the compiler catches
after finalize’s name-closure check on declared imports).
The set is subcontext_construction.md §7’s error contract:
Self::UnboundImport, Self::FinalShadow,
Self::DuplicateChild, Self::Compile,
Self::StrictNonePropagation, and Self::Bind for a child the
binder could not build under its parent. An import’s type and modifier are
checked by the compiler and the kernel’s slot types, not here
(subcontext_construction.md §2.2).
Variants§
UnboundImport
Rule 1 — Import resolution: an artifact import has no matching parent export.
FinalShadow
Rule 2 — Final-shadow on export: a child can’t redefine
a parent const output.
DuplicateChild
Named-child registry: a duplicate spawn under the same name (subcontext_construction.md §4.1). Reports both spawn sites.
Fields
prior_site: Box<SourceContext>Boxed: this is the only variant carrying two
SourceContexts — boxing one keeps the whole enum (and
every Result<_, ContractViolation>) small.
this_site: SourceContextThe second spawn site.
Compile(String)
Polydat compile-time error — the body failed to compile (most commonly an unbound identifier: a free identifier in the body that no import, parent name, or local binding supplies).
StrictNonePropagation
L2.f strict-mode hardening: an intermediate-layer
const binding’s initialization yielded
Value::None, and the build was running with strict
mode enabled. Per composition_substrate.md L2.f’s
strict-mode hardening clause, silent fall-through to
the outer scope’s binding is rejected in strict mode —
the author must either ensure the const yields a
defined value or remove the binding and declare an
explicit extern <name> if fall-through to outer was
intended. The bindings field carries every const
output that materialised to None.
Fields
site: SourceContextWhere the bindings are declared.
Bind(Arc<KernelError>)
Binding the compiled child under its parent failed: a value copied from the parent was refused, a const failed when the child was initialized, or the parent’s engine refused the child’s program.
Trait Implementations§
Source§impl Clone for ContractViolation
impl Clone for ContractViolation
Source§impl Debug for ContractViolation
impl Debug for ContractViolation
Source§impl Display for ContractViolation
impl Display for ContractViolation
Source§impl Error for ContractViolation
impl Error for ContractViolation
1.30.0 · 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<KernelError> for ContractViolation
impl From<KernelError> for ContractViolation
Source§fn from(e: KernelError) -> Self
fn from(e: KernelError) -> Self
Auto Trait Implementations§
impl Freeze for ContractViolation
impl RefUnwindSafe for ContractViolation
impl Send for ContractViolation
impl Sync for ContractViolation
impl Unpin for ContractViolation
impl UnsafeUnpin for ContractViolation
impl UnwindSafe for ContractViolation
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read more