[−][src]Macro proc_macro_error::span_error
Makes a MacroError instance from provided arguments (panic!-like)
and triggers panic in hope it will be caught by filter_macro_errors!.
Syntax
This macro is meant to be a panic! drop-in replacement so its syntax is very similar to panic!,
but it has three forms instead of two:
- "panic-format-like" form: span, formatting
strliteral, comma-separated list of args. First argument is a span, all the rest gets passed toformat!to build the error message. - "panic-single-arg-like" form: span, expr, no comma at the end.
First argument is a span, the second is our error message, it must implement
ToString. - "MacroError::trigger-like" form: single expr.
Literally
MacroError::from(arg).trigger(). It's here just for convenience sospan_error!can be used with instances ofsyn::Error,MacroError, [&str],Stringand so on...