pub enum ContractViolation {
UnboundImport {
import: String,
site: SourceContext,
},
Type {
import: String,
required: PortType,
parent_export: PortType,
site: SourceContext,
},
Modifier {
import: String,
detail: String,
site: SourceContext,
},
FinalShadow {
export: String,
site: SourceContext,
},
Phase2WriteThrough {
export: String,
site: SourceContext,
note: &'static str,
},
DuplicateChild {
name: ChildName,
prior_site: Box<SourceContext>,
this_site: SourceContext,
},
Compile(String),
StrictNonePropagation {
bindings: Vec<String>,
site: SourceContext,
},
}Expand description
Contract violation surfaced at finalize or spawn.
Variants per SRD-67 §“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 active set is the design doc’s §7 error contract:
Self::UnboundImport, Self::FinalShadow,
Self::DuplicateChild, Self::Compile, and
Self::StrictNonePropagation. Self::Type,
Self::Modifier, and Self::Phase2WriteThrough are
retained as compatibility surface and are not emitted by the
builder (design doc §2.2).
Variants§
UnboundImport
Rule 1 — Import resolution: an artifact import has no matching parent export.
Type
Rule 1 — Type mismatch on import.
Fields
site: SourceContextWhere the import is declared.
Modifier
Rule 1 — Modifier mismatch (e.g. shared import against a non-shared parent export).
Fields
site: SourceContextWhere the import is declared.
FinalShadow
Rule 2 — Final-shadow on export: a child can’t redefine an immutable parent export.
Phase2WriteThrough
Rule 2 — Shared write-through rewrite was required but could not be performed.
Never emitted. The rewrite is implemented in
super::SubcontextBuilder::finalize (design doc §3.1),
which reports a rewrite that fails to produce its input
slot or synthetic output as Self::Compile; success is
visible as super::ScopeModule::write_throughs. The
variant is kept as compatibility surface for callers that
pattern-match on it (design doc §2.2).
Fields
site: SourceContextWhere the export is declared.
DuplicateChild
Named-child registry: a duplicate spawn under the same name (SRD-67 §“Named-child registry”). 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: unbound identifier; corresponds to Rule 1’s closure-binding economy detecting a free identifier with no matching import).
StrictNonePropagation
L2.f strict-mode hardening: an intermediate-layer
const binding’s Plan B materialisation 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.
Trait Implementations§
Source§impl Clone for ContractViolation
impl Clone for ContractViolation
Source§fn clone(&self) -> ContractViolation
fn clone(&self) -> ContractViolation
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§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()
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