Struct syntax::errors::DiagnosticBuilder
[−]
[src]
#[must_use] pub struct DiagnosticBuilder<'a> { // some fields omitted }
rustc_private
)Used for emitting structured error messages and other diagnostic information.
Methods
impl<'a> DiagnosticBuilder<'a>
[src]
fn emit(&mut self)
rustc_private
)Emit the diagnostic.
fn cancel(&mut self)
rustc_private
)Cancel the diagnostic (a structured diagnostic must either be emitted or
cancelled or it will panic when dropped).
BEWARE: if this DiagnosticBuilder is an error, then creating it will
bump the error count on the Handler and cancelling it won't undo that.
If you want to decrement the error count you should use Handler::cancel
.
fn cancelled(&self) -> bool
fn is_fatal(&self) -> bool
fn span_label(&mut self, span: Span, label: &Display) -> &mut DiagnosticBuilder<'a>
rustc_private
)Add a span/label to be included in the resulting snippet.
This is pushed onto the MultiSpan
that was created when the
diagnostic was first built. If you don't call this function at
all, and you just supplied a Span
to create the diagnostic,
then the snippet will just include that Span
, which is
called the primary span.
fn note_expected_found(&mut self, label: &Display, expected: &Display, found: &Display) -> &mut DiagnosticBuilder<'a>
fn note(&mut self, msg: &str) -> &mut DiagnosticBuilder<'a>
fn span_note<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut DiagnosticBuilder<'a>
fn warn(&mut self, msg: &str) -> &mut DiagnosticBuilder<'a>
fn span_warn<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut DiagnosticBuilder<'a>
fn help(&mut self, msg: &str) -> &mut DiagnosticBuilder<'a>
fn span_help<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut DiagnosticBuilder<'a>
fn span_suggestion<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str, suggestion: String) -> &mut DiagnosticBuilder<'a>
rustc_private
)Prints out a message with a suggested edit of the code.
See diagnostic::RenderSpan::Suggestion
for more information.
fn set_span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self
fn code(&mut self, s: String) -> &mut Self
fn message(&self) -> &str
fn level(&self) -> Level
Trait Implementations
impl<'a> Debug for DiagnosticBuilder<'a>
[src]
impl<'a> Drop for DiagnosticBuilder<'a>
[src]
Destructor bomb - a DiagnosticBuilder must be either emitted or cancelled or we emit a bug.
Derived Implementations
impl<'a> Clone for DiagnosticBuilder<'a>
[src]
fn clone(&self) -> DiagnosticBuilder<'a>
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more