Expand description
Diagnostics: spans, severities, and the structured form every message is built as.
Design: spec/03-architecture.md. Layer rank 1, see spec/18-package-layout.md.
A diagnostic is a value, not a string. It is rendered to a terminal, to JSON for editors,
or not at all when a caller is only counting errors, and building it as a value is what
makes those three the same code path. spec/03-architecture.md makes the JSON form a
tier 2 stability promise because editors consume it.
§Status
The severity, span and diagnostic types are real, and so is the source map that turns a
span back into a file, a line and a column. Rendering and the -fdiagnostics-format=
plumbing are the remaining piece.
This crate is tier 3 in spec/18-package-layout.md section 18.5: its Rust API is
explicitly unstable and will change without a major version bump.
Structs§
- Diagnostic
- One message, with the place it is about and any attached sub-diagnostics.
- Errors
- The diagnostics a pass produced, and the limit on how many it will produce.
- FileId
- A file in the source map.
- Loc
- A position resolved back to a human coordinate.
- Presumed
Loc - Where a position is presented as being, which is where a
#linesays it is. - Source
Bytes - The contents of a file, shared rather than copied.
- Source
File - The bytes of one file, plus where they sit in the flat space.
- Source
Map - Every file of one translation unit, laid end to end.
- Source
MapFull - The flat coordinate space is full.
- Span
- A half-open range of source,
lo .. hi.
Enums§
- Severity
- How bad a diagnostic is.
Constants§
- DEFAULT_
ERROR_ LIMIT - How many errors are reported before a pass gives up.
Type Aliases§
- BytePos
- A byte offset into the concatenated source map.