pub struct Diagnostic {
pub severity: Severity,
pub code: String,
pub message: String,
pub primary: Option<Span>,
pub labels: Vec<Label>,
pub rule: Option<String>,
pub help: Option<String>,
}Expand description
A compiler or runtime message about a specific place in source.
Fields§
§severity: Severity§code: StringStable identifier such as cove::parse::unexpected_token.
message: String§primary: Option<Span>§labels: Vec<Label>§rule: Option<String>The Cove rule this diagnostic enforces, in one sentence.
help: Option<String>An unambiguous textual correction, when one exists.
Implementations§
Source§impl Diagnostic
impl Diagnostic
pub fn error(code: impl Into<String>, message: impl Into<String>) -> Self
pub fn warning(code: impl Into<String>, message: impl Into<String>) -> Self
Sourcepub fn note(code: impl Into<String>, message: impl Into<String>) -> Self
pub fn note(code: impl Into<String>, message: impl Into<String>) -> Self
Something the toolchain deliberately did not check, said out loud.
A note is not a complaint. It reports a place where a rule of the language, or a promise a schema made, leaves the compiler nothing to prove, so that a run which succeeds still says which of its silences were chosen ones.
pub fn at(self, span: Span) -> Self
pub fn label(self, span: Span, message: impl Into<String>) -> Self
pub fn rule(self, rule: impl Into<String>) -> Self
pub fn help(self, help: impl Into<String>) -> Self
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 moreAuto 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