Expand description
Owning source identities for diagnostics across module collections.
A location retains its immutable file name and text even after its source map is dropped. Native definitions use labels with no location.
use adam_lang::{SourceMap, SourceLabel, SourceLocation};
use cel_parser::SourceSpan;
let mut sources = SourceMap::new();
let source = sources.insert("example.adm2", "sheet example {}");
let label = SourceLabel {
location: Some(SourceLocation { source, span: SourceSpan::new(1, 0, 1, 5) }),
label: "sheet declaration".into(),
};
drop(sources);
assert_eq!(label.location.unwrap().source.file_name(), "example.adm2");Structs§
- Module
Cause - Shares an immutable diagnostic cause with identity-based equality.
- Module
Diagnostic - Owns a module error message and all sources needed by its labels.
- Source
Id - Identifies and owns one source independently of its collection’s lifetime.
- Source
Label - Labels a source region, or a source-free native definition without a location.
- Source
Location - Retains a real source owner and its line/column span.
- Source
Map - Collects immutable source owners in insertion order without filesystem IO.