[][src]Macro proc_macro_error::abort

macro_rules! abort {
    ($($tts:tt)*) => { ... };

Makes a MacroError instance from provided arguments and aborts showing it.


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:

  1. "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.

  2. "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.

  3. MacroError::abort-like form: abort!(error_expr)

    Literally MacroError::from(arg).abort(). It's here just for convenience so abort! can be used with instances of syn::Error, MacroError, [&str], String and so on...