pub struct Diagnostic {
pub severity: Severity,
pub code: &'static str,
pub message: String,
pub primary: Span,
pub primary_label: Option<String>,
pub labels: Vec<Label>,
pub notes: Vec<String>,
pub fix: Option<String>,
pub expansion: Vec<ExpansionStep>,
}Fields§
§severity: Severity§code: &'static strA stable code (B0101) so that tests, docs and the eventual error index agree.
message: String§primary: Span§primary_label: Option<String>§labels: Vec<Label>§notes: Vec<String>§fix: Option<String>A suggested edit. Placement ambiguity is “a compile error with a suggested annotation — never a silent guess” (§3.4), and this is where that suggestion rides.
expansion: Vec<ExpansionStep>Implementations§
Source§impl Diagnostic
impl Diagnostic
pub fn error( code: &'static str, message: impl Into<String>, primary: Span, ) -> Diagnostic
pub fn warning( code: &'static str, message: impl Into<String>, primary: Span, ) -> Diagnostic
pub fn with_primary_label(self, label: impl Into<String>) -> Diagnostic
pub fn with_label(self, span: Span, message: impl Into<String>) -> Diagnostic
pub fn with_note(self, note: impl Into<String>) -> Diagnostic
pub fn with_fix(self, fix: impl Into<String>) -> Diagnostic
pub fn with_expansion(self, steps: Vec<ExpansionStep>) -> Diagnostic
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 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for Diagnostic
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin 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