6 releases

0.1.6 Apr 20, 2026
0.1.5 Apr 14, 2026
0.1.0 Mar 28, 2026

#196 in Value formatting


Used in 13 crates

MIT license

78KB
1K SLoC

Diagnostic infrastructure for the CJC compiler.

This crate provides the core building blocks for reporting errors, warnings, and hints throughout the CJC compilation pipeline (lexer through MIR execution).

Key types

  • Span — byte-offset range identifying a region in source code.
  • SourceMap — precomputed line-start table for O(log n) byte-offset to (line, column) lookups.
  • Diagnostic — a single error, warning, or hint with labels, hints, and optional fix suggestions.
  • DiagnosticBag — growable collection of diagnostics with configurable error-count limits and batch rendering.
  • DiagnosticBuilder — fluent builder for constructing diagnostics from typed ErrorCode values.
  • DiagnosticRenderer — renders diagnostics to human-readable strings with source context, underlines, and optional ANSI color.
  • ErrorCode — typed error code enum covering the entire compiler pipeline (E0xxx through E9xxx, W0xxx).
  • Severity — error, warning, or hint classification.
  • DiagnosticFormat — rich (multi-line with source context) or short (machine-readable one-liner) output format.

No runtime deps