Skip to main content

Module span

Module span 

Source
Expand description

Source position spans.

Structs§

FileId
T3.5 (R2.2): which file a Span belongs to. Allocated once per file by the same “one counter, threaded from the per-project parse loop” shape T3.4 used for ExprId (phase_parse/parse_sources in bynk-emit). Defaults to FileId::UNKNOWN — most Span construction across the workspace is either purely position-arithmetic (merge/offset, which propagate whatever file the input spans already carried) or a synthetic/single-file context (an LSP code action, a checker-internal zero-width span) that was never at risk of the R2.2 defect (a label rendered against the wrong file) in the first place — the defect is specifically about a Span compared or rendered across files, and those all originate at the lexer, the one place FileId::UNKNOWN is never used.
LineIndex
A per-snapshot table of line-start byte offsets, built once and shared by every position lookup over that snapshot (#732).
Span
A byte range in the source. Half-open: [start, end).

Functions§

line_col
1-indexed (line, column) of a byte offset in source. Columns count characters, not bytes. Lives in the syntax leaf so every layer that maps a span to a position — the emitter’s assertion locations, bynkc’s short rendering, and (slice 6) bynk-render — shares one implementation.