[−][src]Struct proc_macro_error::Diagnostic
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]
fn to_tokens(&self, ts: &mut TokenStream)
[src]
fn to_token_stream(&self) -> TokenStream
[src]
fn into_token_stream(self) -> TokenStream
[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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Spanned for T where
T: Spanned + ?Sized,
[src]
T: Spanned + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
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, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,