[−][src]Struct proc_macro_error::MacroError
An error in a proc-macro. This struct preserves
the given span so rustc can highlight the exact place in user code
responsible for the error.
You're not supposed to use this type directly, use span_error! and call_site_error!.
Methods
impl MacroError[src]
pub fn new(span: Span, msg: String) -> Self[src]
Create an error with the span and message provided.
pub fn call_site(msg: String) -> Self[src]
A shortcut for MacroError::new(Span::call_site(), message)
pub fn into_compile_error(self) -> TokenStream[src]
Convert this error into a TokenStream containing these tokens: compiler_error!(<message>);.
All these tokens carry the span this error contains attached.
pub fn set_span(&mut self, span: Span)[src]
Abandon the old span and replace it with the given one.
Trait Implementations
impl From<Error> for MacroError[src]
impl From<String> for MacroError[src]
impl<'_> From<&'_ str> for MacroError[src]
impl ToString for MacroError[src]
impl Debug for MacroError[src]
Auto Trait Implementations
impl Unpin for MacroError
impl !Sync for MacroError
impl !Send for MacroError
impl !RefUnwindSafe for MacroError
impl UnwindSafe for MacroError
Blanket Implementations
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T> ToString for T where
T: Display + ?Sized, [src]
T: Display + ?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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]
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> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,