Skip to main content

Module sourcemap

Module sourcemap 

Source
Expand description

Source map for the diagnostic bridge.

Maps generated Rust code back to LOGOS source positions, enabling friendly error messages for ownership/lifetime errors detected by rustc.

§Architecture

LOGOS Source    CodeGen    Rust Source    rustc    Diagnostics
    │              │            │           │           │
    │ SourceMap    │            │           │           │
    │◄─────────────┼────────────┼───────────┼───────────┤
    │   line 5     │            │  line 12  │   E0382   │
    │   span       │            │           │   line 12 │
    └──────────────┴────────────┴───────────┴───────────┘

§Usage

The source map is built during code generation by calling builder methods at each statement. The diagnostic bridge then uses SourceMap::find_nearest_span to translate rustc line numbers.

Structs§

SourceMap
Maps generated Rust code back to LOGOS source.
SourceMapBuilder
Builder for constructing a SourceMap during code generation.
VarOrigin
Variable origin tracking for error translation.

Enums§

OwnershipRole
Semantic role of a variable in LOGOS ownership semantics.