Struct Diagnostic
pub struct Diagnostic { /* private fields */ }Expand description
A diagnostic emitted by the compiler.
Implementations§
§impl Diagnostic
impl Diagnostic
pub fn error_at_location(message: String, loc: SourceLocation) -> Self
pub fn error_at_location(message: String, loc: SourceLocation) -> Self
Creates an error diagnostic with the given error message and source code location.
pub fn warning_at_location(
kind: WarningKind,
message: String,
loc: SourceLocation,
) -> Self
pub fn warning_at_location( kind: WarningKind, message: String, loc: SourceLocation, ) -> Self
Creates a new warning diagnostic with the given message and source code location.
pub fn convert_to_error(self) -> Self
pub fn convert_to_error(self) -> Self
Consumes the diagnostic and returns an equivalent with its kind set to DiagnosticKind:Error.
pub fn kind(&self) -> DiagnosticKind
pub fn kind(&self) -> DiagnosticKind
The kind of diagnostic.
pub fn add_location(&mut self, loc: SourceLocation)
pub fn add_location(&mut self, loc: SourceLocation)
Adds an additional source location to the diagnostic.
pub fn add_note(&mut self, note: String, loc: Option<SourceLocation>)
pub fn add_note(&mut self, note: String, loc: Option<SourceLocation>)
Adds a note to the diagnostic.
pub fn add_note_with_suggested_code(
&mut self,
note: String,
code: SuggestedCode,
loc: Option<SourceLocation>,
)
pub fn add_note_with_suggested_code( &mut self, note: String, code: SuggestedCode, loc: Option<SourceLocation>, )
Adds a note to the diagnostic.
Trait Implementations§
Auto 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