[][src]Struct proc_macro_error::Diagnostic

pub struct Diagnostic { /* fields omitted */ }

Represents a single diagnostic message

Methods

impl Diagnostic[src]

pub fn new(level: Level, message: String) -> Self[src]

Create a new diagnostic message that points to Span::call_site()

pub fn spanned(span: Span, level: Level, message: String) -> Self[src]

Create a new diagnostic message that points to the span

pub fn span_error(self, span: Span, msg: String) -> Self[src]

Add another error message to self such that it will be emitted right after the main message.

pub fn span_help(self, span: Span, msg: String) -> Self[src]

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

pub fn help(self, msg: String) -> Self[src]

Attach a "help" note to your main message.

pub fn span_note(self, span: Span, msg: String) -> Self[src]

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

pub fn note(self, msg: String) -> Self[src]

Attach a note to your main message

pub fn message(&self) -> &str[src]

The message of main warning/error (no notes attached)

pub fn abort(self) -> ![src]

Abort the proc-macro's execution and display the diagnostic.

Warnings

Warnings do not get emitted on stable/beta but this function will abort anyway.

pub fn emit(self)[src]

Display the diagnostic while not aborting macro execution.

Warnings

Warnings are ignored on stable/beta

Trait Implementations

impl Debug for Diagnostic[src]

impl From<Error> for Diagnostic[src]

impl ToTokens for Diagnostic[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Spanned for T where
    T: Spanned + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.