Struct rustc_errors::diagnostic::Diagnostic
[−]
[src]
#[must_use]pub struct Diagnostic { pub level: Level, pub message: Vec<(String, Style)>, pub code: Option<String>, pub span: MultiSpan, pub children: Vec<SubDiagnostic>, }
rustc_private
)Fields
level: Level
rustc_private
)message: Vec<(String, Style)>
rustc_private
)code: Option<String>
rustc_private
)span: MultiSpan
rustc_private
)children: Vec<SubDiagnostic>
rustc_private
)Methods
impl Diagnostic
[src]
fn new(level: Level, message: &str) -> Self
rustc_private
)fn new_with_code(level: Level, code: Option<String>, message: &str) -> Self
rustc_private
)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
rustc_private
)fn is_fatal(&self) -> bool
rustc_private
)fn span_label(&mut self, span: Span, label: &Display) -> &mut Self
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 Self
label: &Display,
expected: &Display,
found: &Display)
-> &mut Self
rustc_private
)fn note_expected_found_extra(&mut self,
label: &Display,
expected: &Display,
found: &Display,
expected_extra: &Display,
found_extra: &Display)
-> &mut Self
label: &Display,
expected: &Display,
found: &Display,
expected_extra: &Display,
found_extra: &Display)
-> &mut Self
rustc_private
)fn note(&mut self, msg: &str) -> &mut Self
rustc_private
)fn highlighted_note(&mut self, msg: Vec<(String, Style)>) -> &mut Self
rustc_private
)fn span_note<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self
rustc_private
)fn warn(&mut self, msg: &str) -> &mut Self
rustc_private
)fn span_warn<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self
rustc_private
)fn help(&mut self, msg: &str) -> &mut Self
rustc_private
)fn span_help<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self
rustc_private
)fn span_suggestion<S: Into<MultiSpan>>(&mut self,
sp: S,
msg: &str,
suggestion: String)
-> &mut Self
sp: S,
msg: &str,
suggestion: String)
-> &mut Self
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
rustc_private
)fn code(&mut self, s: String) -> &mut Self
rustc_private
)fn message(&self) -> String
rustc_private
)fn styled_message(&self) -> &Vec<(String, Style)>
rustc_private
)fn level(&self) -> Level
rustc_private
)fn copy_details_not_message(&mut self, from: &Diagnostic)
rustc_private
)Used by a lint. Copies over all details but the "main message".
Trait Implementations
impl Clone for Diagnostic
[src]
fn clone(&self) -> Diagnostic
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
impl Debug for Diagnostic
[src]
impl PartialEq for Diagnostic
[src]
fn eq(&self, __arg_0: &Diagnostic) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Diagnostic) -> bool
This method tests for !=
.
impl Encodable for Diagnostic
[src]
fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
deprecated in favor of rustc-serialize on crates.io
impl Decodable for Diagnostic
[src]
fn decode<__D: Decoder>(__arg_0: &mut __D) -> Result<Diagnostic, __D::Error>
🔬 This is a nightly-only experimental API. (rustc_private
)
deprecated in favor of rustc-serialize on crates.io