logos.lang.panic

Module lang · package logos-lang

Traits

traitRefUnwindSafe

trait RefUnwindSafe

Marks &T as unwind-safe — the shared-reference analogue of UnwindSafe. Not auto-derived today.

Implemented by: AssertUnwindSafe

traitUnwindSafe

trait UnwindSafe

Marks a type as safe to observe after an unwind (catch_unwind bound). Not auto-derived today — opt in with an explicit impl or AssertUnwindSafe.

Implemented by: AssertUnwindSafe

Types

structAssertUnwindSafe

struct AssertUnwindSafe

Wraps a value to unconditionally assert UnwindSafe/RefUnwindSafe — the escape hatch for types without the marker impls.

Implements: UnwindSafe RefUnwindSafe

Fields

value: T

The wrapped value.

structLocation

struct Location

Identifies the source position (file, line, column) where a panic originated. Mirror of core::panic::Location; populated only by explicit construction today — there is no compiler-injected caller() yet.

Fields

column: u32

Column number within line.

file: &[u8]

Source file path.

line: u32

Line number within file.

structPanicInfo

struct PanicInfo

Carries a panic’s message plus its optional origin; mirror of core::panic::PanicInfo.

Fields

location: Option

Panic origin; currently always None — the hook does not capture call-site location.

message: &[u8]

The str that was passed to panic().

Functions

fnassert

fn assert(cond: bool, msg: &[u8]) -> void

Panics with msg if cond is false.

fncatch_unwind

fn catch_unwind(f: fn() -> void) -> Result

Runs f under panic recovery: Ok(()) on normal return, Err(msg) if f panicked. The error is the str passed to panic(). Diverges from Rust: takes a plain fn-ptr (no closure captures) and captures the message as str, not Box<dyn Any>.

fnlocation

fn location(file: &[u8], line: u32, column: u32) -> Location

Creates a Location for the given source position.

fnpanic

fn panic(msg: &[u8]) -> !

Aborts execution with an unrecoverable error, printing panic: <msg> to stderr. If a recovery handler is installed (catch_unwind or the #[test] runner), control longjmps to it instead of aborting the process.