diag-lang 1.0.0

Diagnostics: error collection and caret-style source-annotated rendering.
Documentation

Installation

[dependencies]
diag-lang = "1"

Example

use diag_lang::{Diagnostic, Label, Renderer, Severity, SourceMap, Span};

let mut map = SourceMap::new();
map.add("main.rs", "fn main() {\n    let x = foo();\n}\n").unwrap();

let diag = Diagnostic::new(
    Severity::Error,
    "cannot find value `foo` in this scope",
    Label::new(Span::new(24, 27), "not found in this scope"),
);

print!("{}", Renderer::new().render(&diag, &map));
error: cannot find value `foo` in this scope
 --> main.rs:2:13
  |
2 |     let x = foo();
  |             ^^^ not found in this scope
  |

Status

This is v1.0.0: the public API is stable and frozen under SemVer. The diagnostic model and renderer are complete — multi-line spans, secondary labels, notes/help, and optional ANSI colour (the color feature) with plain output staying complete and correctly aligned. The full surface is catalogued in docs/API.md.

Contributing

See dev/DIRECTIVES.md for engineering standards and the definition of done. Before a PR: cargo fmt --all, cargo clippy --all-targets --all-features -- -D warnings, and cargo test --all-features must be clean.