pub struct Diagnostic {
pub severity: Severity,
pub message: String,
pub source: Option<SourceId>,
pub span: Option<Span>,
pub code: Option<Symbol>,
pub related: Vec<Diagnostic>,
}Expand description
A structured diagnostic message with optional source location.
The kernel defines the diagnostic record; libraries and contracts attach diagnostics to errors to explain failures with source context.
Fields§
§severity: SeverityThe severity level.
message: StringThe human-readable message.
source: Option<SourceId>The optional source the diagnostic refers to.
span: Option<Span>The optional span within the source.
code: Option<Symbol>The optional machine-readable diagnostic code.
Related sub-diagnostics providing more detail.
Implementations§
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Diagnostic
impl Debug for Diagnostic
impl Eq for Diagnostic
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
Source§fn eq(&self, other: &Diagnostic) -> bool
fn eq(&self, other: &Diagnostic) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Diagnostic
Auto Trait Implementations§
impl Freeze for Diagnostic
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin for Diagnostic
impl UnsafeUnpin for Diagnostic
impl UnwindSafe for Diagnostic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more