use-diagnostic-span
Generic diagnostic source and span primitives for RustUse.
Foundation
use-diagnostic-span provides DiagnosticPosition, DiagnosticSourceId, and DiagnosticSpan for identifying source locations without assuming files, snippets, renderers, or terminal output.
Positions are 1-based. A span may include a source ID for a file, buffer, document, or virtual source, but source IDs are plain stable strings rather than filesystem-only paths.
Example
use ;
let source = new.unwrap;
let start = new.unwrap;
let end = new.unwrap;
let span = new.unwrap;
assert_eq!;
assert!;
Scope
- Positions use 1-based line and column numbers.
- Spans validate that the end is not before the start.
- Source IDs are generic stable strings.
- File reading, snippet extraction, and source rendering are out of scope.
Status
use-diagnostic-span is a pre-1.0 crate with a deliberately small API.