pub struct ResolvedDiagnostic {
pub path: String,
pub file: FileId,
pub range: TextRange,
pub message: String,
pub code: DiagnosticCode,
pub severity: Severity,
}Expand description
A diagnostic resolved for consumption outside the compiler.
The internal [Diagnostic] keys a file by FileId — an interning index
that is only meaningful inside the compiler instance that produced it and
is not stable across recompiles. A consumer (an editor, a host integration,
an LSP) cannot map that id back to a file on its own. ResolvedDiagnostic
carries the file’s path — byte-identical to the string the host used as
the entry point / answered the read_file callback with — so a diagnostic
can always be located. file is retained for in-result correlation only.
range is left as byte offsets into the file’s source. Line/column
resolution is deliberately not baked in: column units are consumer-specific
(LSP uses UTF-16 code units, a terminal uses bytes or chars), and the
consumer already holds the source text to resolve them in the unit it needs.
Fields§
§path: StringThe file this diagnostic belongs to, keyed by its source path.
file: FileIdThe originating file’s interning id — for in-result correlation only.
range: TextRangeThe source span this diagnostic points at, as byte offsets.
message: StringHuman-readable message describing the problem.
code: DiagnosticCodeStructured error code for documentation and tooling.
severity: SeverityThe severity this diagnostic was actually resolved at
(brink_analyzer::effective_severity, not the raw
DiagnosticCode::severity default) — a [lints] re-leveled code
(including a down-level to Info/Hint, issue #1162) carries its
overridden severity here, so a renderer never has to re-derive it
(and never has to assume every CompileOutput::warnings entry is
actually Severity::Warning).
Trait Implementations§
Source§impl Clone for ResolvedDiagnostic
impl Clone for ResolvedDiagnostic
Source§fn clone(&self) -> ResolvedDiagnostic
fn clone(&self) -> ResolvedDiagnostic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more