Crate beck_diag

Crate beck_diag 

Source
Expand description

Diagnostics as structured values, and the one renderer that prints them.

docs/04-compiler-architecture.md §4.5: “for a language whose main feature is inference, error quality is the product”. Concretely that means three things, and this crate is where all three live:

  • every diagnostic is a value (code, primary span, secondary spans, notes, fix-its), never a formatted string thrown at stderr;
  • one renderer is shared by the CLI, the snapshot suite and (later) the LSP, so the two cannot drift;
  • macro-generated code carries its expansion chain, so a type error inside derive(Json) says where the derive was written.

Modules§

depth
The front end’s nesting ceiling: a count, and the host stack that count implies.
index
The error index: every code the compiler can emit, in one place.

Structs§

Diagnostic
Diagnostics
Diagnostics accumulated by one compilation.
ExpansionStep
One step of a macro expansion chain — “in derive(Json) expanded at orders.beck:12” (§4.5).
FileId
A file in the compilation. Interned by SourceMap.
Label
A secondary span: somewhere else the reader needs to look.
SourceMap
Span
A byte range within a file.

Enums§

Severity

Functions§

render
The renderer. Modelled on rustc/Elm: severity line, location, the source line with a caret span, then secondary labels, notes and the fix-it.