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: SpanWhere 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: SymbolThe component (or store, or page) whose action/handler this sentence is written in.
action: SymbolThe 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
impl FailureSite
Sourcepub fn render(&self, interner: &Interner, message: &str) -> String
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
impl Clone for FailureSite
Source§fn clone(&self) -> FailureSite
fn clone(&self) -> FailureSite
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for FailureSite
impl Debug for FailureSite
impl Copy for FailureSite
Auto Trait Implementations§
impl Freeze for FailureSite
impl RefUnwindSafe for FailureSite
impl Send for FailureSite
impl Sync for FailureSite
impl Unpin for FailureSite
impl UnsafeUnpin for FailureSite
impl UnwindSafe for FailureSite
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.