diag-lang 0.4.0

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

Installation

[dependencies]
diag-lang = "0.4"

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 v0.4.0: the full diagnostic model and renderer — multi-line spans, secondary labels, notes/help, and optional ANSI colour (the color feature) with plain output staying complete. The surface is feature-complete and documented as the freeze candidate in docs/API.md; 1.0.0 freezes it under SemVer. See the ROADMAP.

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.