Skip to main content

FailureSite

Struct FailureSite 

Source
pub struct FailureSite {
    pub span: Span,
    pub component: Symbol,
    pub action: Symbol,
}
Expand description

One entry in Parser::failure_sites — everything a runtime failure needs to point BACK at the sentence a Stmt::Site marker stood in front of.

★ “CURRENT SITE = n” IS ENOUGH, AND HERE IS WHY. A trap does not need a call stack to be useful — LOGOS actions do not recurse into each other’s OWN bodies the way a general-purpose language’s functions do (an action calls another via Call <Store>'s <action>, a dispatch through data, not a nested nomination-time invocation whose OWN Sites would need distinguishing on a stack) — so “which Site did the runtime most recently pass through” already answers “which sentence trapped” unambiguously, for the same reason a program counter alone (no full backtrace) already answers it in a language with no first-class stack frames to unwind through. A future construct that DOES nest one action’s failure inside another’s turn is exactly the case that would need this reconsidered — flagging it here so nobody has to rediscover why a stack was not built.

★ NO file FIELD, ON PURPOSE. A Parser parses ONE flat token stream and has no concept of splicing at all — loader::apply_prelude_mapped assembles a user file plus its demand-imported stdlib modules into that ONE stream BEFORE the parser ever sees it, and ui_bridge.rs’s checked seam is what undoes the splice, exactly once, on whatever span leaves the compile pipeline (item 10 of this session’s own record — the double-mapping bug that fix closed). span here is in the SAME spliced coordinates every other span this parser hands out is in, for the same reason: a second, bespoke translation point for FailureSite spans specifically would be exactly the double-mapping shape that bug already was. Whoever renders a FailureSite for a person translates it through the SAME seam every other diagnostic in this pipeline already goes through.

Fields§

§span: Span

Where the marked sentence is, in spliced coordinates — see the field’s own note above for why there is no separate file to pair it with.

§component: Symbol

The component (or store, or page) whose action/handler this sentence is written in.

§action: Symbol

The action or event handler this sentence belongs to — __e3-style synthesized names for a When …: handler, same as every other place this pipeline names one.

Implementations§

Source§

impl FailureSite

Source

pub fn render(&self, interner: &Interner, message: &str) -> String

message (the runtime error text itself, unchanged) wrapped with WHICH sentence raised it — component/action, in the author’s own words wherever this site can recover them. Deliberately does NOT touch file:line:col: span is still in spliced coordinates (this struct’s own doc comment says why there is no file to pair it with), and turning a byte offset into a line/column needs the source text this crate never holds once parsing ends — that translation is ui_bridge.rs’s checked seam’s job, on the SAME span, same as every other diagnostic; this method only ever supplies the component/action half.

An event handler’s action is a synthesized __e<n> (lgx_lower.rs::action_fn_name’s own numbering) — never a name the author wrote, so it is named generically (“an event handler”) rather than surfaced verbatim. An ordinary To <name>: action’s own name IS what the author wrote, and is quoted as `To <name>` to read the same way the section that declares it does.

Trait Implementations§

Source§

impl Clone for FailureSite

Source§

fn clone(&self) -> FailureSite

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 FailureSite

Source§

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

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

impl Copy for FailureSite

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<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,