[−][src]Struct syntax::diagnostics::plugin::Diagnostic
Fields
level: Level
message: Vec<(String, Style)>
code: Option<DiagnosticId>
span: MultiSpan
children: Vec<SubDiagnostic>
suggestions: Vec<CodeSuggestion>
Methods
impl Diagnostic
[src]
impl Diagnostic
pub fn new(level: Level, message: &str) -> Diagnostic | [src] |
pub fn new_with_code( | [src] |
pub fn is_error(&self) -> bool | [src] |
pub fn cancel(&mut self) | [src] |
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 span_label<T>(&mut self, span: Span, label: T) -> &mut Diagnostic where | [src] |
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 replace_span_with(&mut self, after: Span) -> &mut Diagnostic | [src] |
pub fn note_expected_found( | [src] |
pub fn note_expected_found_extra( | [src] |
pub fn note_trait_signature( | [src] |
pub fn note(&mut self, msg: &str) -> &mut Diagnostic | [src] |
pub fn highlighted_note(&mut self, msg: Vec<(String, Style)>) -> &mut Diagnostic | [src] |
pub fn span_note<S>(&mut self, sp: S, msg: &str) -> &mut Diagnostic where | [src] |
pub fn warn(&mut self, msg: &str) -> &mut Diagnostic | [src] |
pub fn span_warn<S>(&mut self, sp: S, msg: &str) -> &mut Diagnostic where | [src] |
pub fn help(&mut self, msg: &str) -> &mut Diagnostic | [src] |
pub fn span_help<S>(&mut self, sp: S, msg: &str) -> &mut Diagnostic where | [src] |
pub fn span_suggestion_short( | [src] |
Use span_suggestion_short_with_applicability
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( | [src] |
Use span_suggestion_with_applicability
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 multipart_suggestion_with_applicability( | [src] |
pub fn multipart_suggestion( | [src] |
Use multipart_suggestion_with_applicability
pub fn span_suggestions( | [src] |
Use span_suggestions_with_applicability
Prints out a message with multiple suggested edits of the code.
pub fn span_suggestion_with_applicability( | [src] |
This is a suggestion that may contain mistakes or fillers and should be read and understood by a human.
pub fn span_suggestions_with_applicability<impl Iterator | [src] |
pub fn span_suggestion_short_with_applicability( | [src] |
pub fn set_span<S>(&mut self, sp: S) -> &mut Diagnostic where | [src] |
pub fn code(&mut self, s: DiagnosticId) -> &mut Diagnostic | [src] |
pub fn get_code(&self) -> Option<DiagnosticId> | [src] |
pub fn message(&self) -> String | [src] |
pub fn styled_message(&self) -> &Vec<(String, Style)> | [src] |
pub fn copy_details_not_message(&mut self, from: &Diagnostic) | [src] |
Used by a lint. Copies over all details but the "main message".
pub fn sub( | [src] |
Convenience function for internal use, clients should use one of the public methods above.
Trait Implementations
impl Hash for Diagnostic
[src]
impl Hash for Diagnostic
fn hash<__H>(&self, state: &mut __H) where | [src] |
fn hash_slice<H>(data: &[Self], state: &mut H) where | 1.3.0 [src] |
Feeds a slice of this type into the given [Hasher
]. Read more
impl Clone for Diagnostic
[src]
impl Clone for Diagnostic
fn clone(&self) -> Diagnostic | [src] |
fn clone_from(&mut self, source: &Self) | 1.0.0 [src] |
Performs copy-assignment from source
. Read more
impl Encodable for Diagnostic
[src]
impl Encodable for Diagnostic
impl Decodable for Diagnostic
[src]
impl Decodable for Diagnostic
fn decode<__D>(d: &mut __D) -> Result<Diagnostic, <__D as Decoder>::Error> where | [src] |
impl PartialEq<Diagnostic> for Diagnostic
[src]
impl PartialEq<Diagnostic> for Diagnostic
fn eq(&self, other: &Diagnostic) -> bool | [src] |
fn ne(&self, other: &Diagnostic) -> bool | [src] |
impl Debug for Diagnostic
[src]
impl Debug for Diagnostic
Auto Trait Implementations
impl !Send for Diagnostic
impl !Send for Diagnostic
impl !Sync for Diagnostic
impl !Sync for Diagnostic
Blanket Implementations
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
impl<T> ToOwned for T where
T: Clone,
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error> | [src] |
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId | [src] |
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T | [src] |
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error> | [src] |
impl<T> Encodable for T where
T: UseSpecializedEncodable + ?Sized,
[src]
impl<T> Encodable for T where
T: UseSpecializedEncodable + ?Sized,
impl<T> Decodable for T where
T: UseSpecializedDecodable,
[src]
impl<T> Decodable for T where
T: UseSpecializedDecodable,
impl<E> SpecializationError for E
[src]
impl<E> SpecializationError for E
impl<T> Erased for T
[src]
impl<T> Erased for T
impl<T> Send for T where
T: ?Sized,
[src]
impl<T> Send for T where
T: ?Sized,
impl<T> Sync for T where
T: ?Sized,
[src]
impl<T> Sync for T where
T: ?Sized,
impl<T> Erased for T
impl<T> Erased for T