Skip to main content

Crate nova_diagnostics

Crate nova_diagnostics 

Source
Expand description

Error reporting infrastructure for the Nova compiler.

Provides Span, FileId, Spanned<T>, and diagnostic rendering via codespan-reporting. Every compiler crate that produces user-facing errors depends on this crate.

Re-exports§

pub use files::FileDb;
pub use files::FileId;
pub use line_index::LineIndex;

Modules§

files
Source file database — maps FileId to source text.
line_index
Byte offsets to LSP positions and back (spec docs/superpowers/specs/2026-10-08-phase-3-2-lsp-core-design.md §5).
lines
Placing an edit by the lines of a source text (spec docs/superpowers/specs/2026-10-10-phase-3-4b-fixes-and-colour-design.md §4.7). Offsets are bytes. The rules step over ASCII only, so every offset they return is on a character boundary.
render
Renders Diagnostic values to stderr using codespan-reporting.
suggest
“Did you mean” (spec docs/superpowers/specs/2026-10-10-phase-3-4b-fixes-and-colour-design.md §4.3).

Structs§

Diagnostic
A single compiler diagnostic shown to the user.
Edit
Replace span’s text with text. An empty span inserts.
Fix
A suggested change: a title, and the text edits that make it (spec docs/superpowers/specs/2026-10-10-phase-3-4b-fixes-and-colour-design.md §3.1). A span carries its file, so one fix may edit several files.
Label
A labelled source location within a diagnostic.
Span
A byte-range span inside a single source file.
Spanned
A value paired with the source span it came from.

Enums§

Severity
Severity level of a diagnostic.