pub struct Diagnostic {
pub diagnostic_id: String,
pub severity: Severity,
pub location: Location,
pub expected: Option<TypeWitness>,
pub found: Option<TypeWitness>,
pub message: String,
pub fixes: Vec<SuggestedFix>,
pub context_window: Option<ContextWindow>,
pub rule: Option<String>,
pub notes: Vec<DiagnosticNote>,
}Expand description
The canonical LSDS diagnostic.
JSON shape matches ADR-006 §9.2. Field names are part of the public wire format; see crate-level docs for the stability contract.
Fields§
§diagnostic_id: StringStable diagnostic identifier — e.g. "B0013", "E0100". The
scheme matches the existing BorrowErrorCode (B-series for
borrow / lifetime / aliasing) and ErrorCode (E-series for
type, parse, semantic) namespaces.
severity: SeveritySeverity bucket.
location: LocationPrimary source location.
expected: Option<TypeWitness>Expected type at this site, when applicable. None for
non-type-related diagnostics (e.g. parse errors).
found: Option<TypeWitness>Found type at this site, when applicable.
message: StringHuman-readable message body (does NOT include the
[B00XX] prefix — that’s the diagnostic_id field’s job;
renderers prepend it on output).
fixes: Vec<SuggestedFix>Ranked suggested fixes; may be empty.
context_window: Option<ContextWindow>Token-budgeted context window for LLM consumers.
rule: Option<String>Citation pointing at the binding spec section that governs this
diagnostic. E.g. "ADR-006-§1.1" or "ADR-005-§4".
notes: Vec<DiagnosticNote>Auxiliary notes. Each note has its own location (e.g. “borrow originates here”) so renderers can present them as related-info callouts.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl<'de> Deserialize<'de> for Diagnostic
impl<'de> Deserialize<'de> for Diagnostic
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
Source§fn eq(&self, other: &Diagnostic) -> bool
fn eq(&self, other: &Diagnostic) -> bool
self and other values to be equal, and is used by ==.