[−][src]Macro proc_macro_error::abort
Makes a MacroError
instance from provided arguments and aborts showing it.
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: `abort!(span_expr, format_str_literal [, format_args...])
First argument is a span, all the rest is passed to
format!
to build the error message. -
"panic-single-arg-like" form:
abort!(span_expr, error_expr)
First argument is a span, the second is the error message, it must implement
ToString
. -
MacroError::abort
-like form:abort!(error_expr)
Literally
MacroError::from(arg).abort()
. It's here just for convenience soabort!
can be used with instances ofsyn::Error
,MacroError
, [&str
],String
and so on...