Struct proc_macro_error::Diagnostic
source · [−]pub struct Diagnostic { /* private fields */ }
Expand description
Represents a single diagnostic message
Implementations
sourceimpl Diagnostic
impl Diagnostic
sourcepub fn new(level: Level, message: String) -> Self
pub fn new(level: Level, message: String) -> Self
Create a new diagnostic message that points to Span::call_site()
sourcepub fn spanned(span: Span, level: Level, message: String) -> Self
pub fn spanned(span: Span, level: Level, message: String) -> Self
Create a new diagnostic message that points to the span
sourcepub fn span_error(self, span: Span, msg: String) -> Self
pub fn span_error(self, span: Span, msg: String) -> Self
Add another error message to self such that it will be emitted right after the main message.
sourcepub fn span_help(self, span: Span, msg: String) -> Self
pub fn span_help(self, span: Span, msg: String) -> Self
Attach a “help” note to your main message, the note will have it’s own span on nightly.
Span
The span is ignored on stable, the note effectively inherits its parent’s (main message) span
sourcepub fn span_note(self, span: Span, msg: String) -> Self
pub fn span_note(self, span: Span, msg: String) -> Self
Attach a note to your main message, the note will have it’s own span on nightly.
Span
The span is ignored on stable, the note effectively inherits its parent’s (main message) span
Trait Implementations
sourceimpl Debug for Diagnostic
impl Debug for Diagnostic
sourceimpl DiagnosticExt for Diagnostic
impl DiagnosticExt for Diagnostic
sourcefn spanned_range(span_range: SpanRange, level: Level, message: String) -> Self
fn spanned_range(span_range: SpanRange, level: Level, message: String) -> Self
Create a new diagnostic message that points to the span_range
. Read more
sourcefn span_range_error(self, span_range: SpanRange, msg: String) -> Self
fn span_range_error(self, span_range: SpanRange, msg: String) -> Self
Add another error message to self such that it will be emitted right after the main message. Read more
sourcefn span_range_help(self, span_range: SpanRange, msg: String) -> Self
fn span_range_help(self, span_range: SpanRange, msg: String) -> Self
Attach a “help” note to your main message, the note will have it’s own span on nightly. Read more
sourcefn span_range_note(self, span_range: SpanRange, msg: String) -> Self
fn span_range_note(self, span_range: SpanRange, msg: String) -> Self
Attach a note to your main message, the note will have it’s own span on nightly. Read more
sourceimpl ToTokens for Diagnostic
impl ToTokens for Diagnostic
sourcefn to_tokens(&self, ts: &mut TokenStream)
fn to_tokens(&self, ts: &mut TokenStream)
Write self
to the given TokenStream
. Read more
sourcefn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
sourcefn into_token_stream(self) -> TokenStream
fn into_token_stream(self) -> TokenStream
Convert self
directly into a TokenStream
object. Read more
Auto Trait Implementations
impl RefUnwindSafe for Diagnostic
impl !Send for Diagnostic
impl !Sync for Diagnostic
impl Unpin for Diagnostic
impl UnwindSafe for Diagnostic
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more