Struct rustc_errors::Diagnostic
[−]
[src]
#[must_use]pub struct Diagnostic { pub level: Level, pub message: Vec<(String, Style)>, pub code: Option<DiagnosticId>, pub span: MultiSpan, pub children: Vec<SubDiagnostic>, pub suggestions: Vec<CodeSuggestion>, }
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Fields
level: Level
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
message: Vec<(String, Style)>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
code: Option<DiagnosticId>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
span: MultiSpan
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
children: Vec<SubDiagnostic>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
suggestions: Vec<CodeSuggestion>
🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Methods
impl Diagnostic[src]
impl Diagnosticpub fn new(level: Level, message: &str) -> Self[src]
pub fn new(level: Level, message: &str) -> Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn new_with_code(
level: Level,
code: Option<DiagnosticId>,
message: &str
) -> Self[src]
pub fn new_with_code(
level: Level,
code: Option<DiagnosticId>,
message: &str
) -> Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn cancel(&mut self)[src]
pub fn cancel(&mut self)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Cancel the diagnostic (a structured diagnostic must either be emitted or canceled or it will panic when dropped).
pub fn cancelled(&self) -> bool[src]
pub fn cancelled(&self) -> bool🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self[src]
pub fn span_label<T: Into<String>>(&mut self, span: Span, label: T) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
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.
pub fn note_expected_found(
&mut self,
label: &Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString
) -> &mut Self[src]
pub fn note_expected_found(
&mut self,
label: &Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString
) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn note_expected_found_extra(
&mut self,
label: &Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
expected_extra: &Display,
found_extra: &Display
) -> &mut Self[src]
pub fn note_expected_found_extra(
&mut self,
label: &Display,
expected: DiagnosticStyledString,
found: DiagnosticStyledString,
expected_extra: &Display,
found_extra: &Display
) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn note_trait_signature(
&mut self,
name: String,
signature: String
) -> &mut Self[src]
pub fn note_trait_signature(
&mut self,
name: String,
signature: String
) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn note(&mut self, msg: &str) -> &mut Self[src]
pub fn note(&mut self, msg: &str) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn highlighted_note(&mut self, msg: Vec<(String, Style)>) -> &mut Self[src]
pub fn highlighted_note(&mut self, msg: Vec<(String, Style)>) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn span_note<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self[src]
pub fn span_note<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn warn(&mut self, msg: &str) -> &mut Self[src]
pub fn warn(&mut self, msg: &str) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn span_warn<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self[src]
pub fn span_warn<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn help(&mut self, msg: &str) -> &mut Self[src]
pub fn help(&mut self, msg: &str) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn span_help<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self[src]
pub fn span_help<S: Into<MultiSpan>>(&mut self, sp: S, msg: &str) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn span_suggestion_short(
&mut self,
sp: Span,
msg: &str,
suggestion: String
) -> &mut Self[src]
pub fn span_suggestion_short(
&mut self,
sp: Span,
msg: &str,
suggestion: String
) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Prints out a message with a suggested edit of the code. If the suggestion is presented inline it will only show the text message and not the text.
See CodeSuggestion for more information.
pub fn span_suggestion(
&mut self,
sp: Span,
msg: &str,
suggestion: String
) -> &mut Self[src]
pub fn span_suggestion(
&mut self,
sp: Span,
msg: &str,
suggestion: String
) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Prints out a message with a suggested edit of the code.
In case of short messages and a simple suggestion, rustc displays it as a label like
"try adding parentheses: (tup.0).1"
The message
- should not end in any punctuation (a
:is added automatically) - should not be a question
- should not contain any parts like "the following", "as shown"
- may look like "to do xyz, use" or "to do xyz, use abc"
- may contain a name of a function, variable or type, but not whole expressions
See CodeSuggestion for more information.
pub fn span_suggestions(
&mut self,
sp: Span,
msg: &str,
suggestions: Vec<String>
) -> &mut Self[src]
pub fn span_suggestions(
&mut self,
sp: Span,
msg: &str,
suggestions: Vec<String>
) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Prints out a message with multiple suggested edits of the code.
pub fn span_approximate_suggestion(
&mut self,
sp: Span,
msg: &str,
suggestion: String
) -> &mut Self[src]
pub fn span_approximate_suggestion(
&mut self,
sp: Span,
msg: &str,
suggestion: String
) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
This is a suggestion that may contain mistakes or fillers and should be read and understood by a human.
pub fn span_approximate_suggestions(
&mut self,
sp: Span,
msg: &str,
suggestions: Vec<String>
) -> &mut Self[src]
pub fn span_approximate_suggestions(
&mut self,
sp: Span,
msg: &str,
suggestions: Vec<String>
) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn set_span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self[src]
pub fn set_span<S: Into<MultiSpan>>(&mut self, sp: S) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn code(&mut self, s: DiagnosticId) -> &mut Self[src]
pub fn code(&mut self, s: DiagnosticId) -> &mut Self🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn get_code(&self) -> Option<DiagnosticId>[src]
pub fn get_code(&self) -> Option<DiagnosticId>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn message(&self) -> String[src]
pub fn message(&self) -> String🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn styled_message(&self) -> &Vec<(String, Style)>[src]
pub fn styled_message(&self) -> &Vec<(String, Style)>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
pub fn copy_details_not_message(&mut self, from: &Diagnostic)[src]
pub fn copy_details_not_message(&mut self, from: &Diagnostic)🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
Used by a lint. Copies over all details but the "main message".
Trait Implementations
impl Clone for Diagnostic[src]
impl Clone for Diagnosticfn clone(&self) -> Diagnostic[src]
fn clone(&self) -> DiagnosticReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)Performs copy-assignment from source. Read more
impl Debug for Diagnostic[src]
impl Debug for Diagnosticfn fmt(&self, __arg_0: &mut Formatter) -> Result[src]
fn fmt(&self, __arg_0: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl PartialEq for Diagnostic[src]
impl PartialEq for Diagnosticfn eq(&self, __arg_0: &Diagnostic) -> bool[src]
fn eq(&self, __arg_0: &Diagnostic) -> boolThis method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Diagnostic) -> bool[src]
fn ne(&self, __arg_0: &Diagnostic) -> boolThis method tests for !=.
impl Hash for Diagnostic[src]
impl Hash for Diagnosticfn hash<__H: Hasher>(&self, __arg_0: &mut __H)[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)Feeds this value into the given [Hasher]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, Feeds a slice of this type into the given [Hasher]. Read more
impl Encodable for Diagnostic[src]
impl Encodable for Diagnosticfn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>[src]
fn encode<__S: Encoder>(&self, __arg_0: &mut __S) -> Result<(), __S::Error>🔬 This is a nightly-only experimental API. (rustc_private)
this crate is being loaded from the sysroot, an unstable location; did you mean to load this crate from crates.io via Cargo.toml instead?
impl Decodable for Diagnostic[src]
impl Decodable for DiagnosticAuto Trait Implementations
impl !Send for Diagnostic
impl !Send for Diagnosticimpl !Sync for Diagnostic
impl !Sync for Diagnostic