Deprecated: The each() function is deprecated. This message will be suppressed on further calls in /home/zhenxiangba/zhenxiangba.com/public_html/phproxy-improved-master/index.php on line 456
abort in proc_macro_error - Rust
[go: Go Back, main page]

Macro proc_macro_error::abort

source ·
macro_rules! abort {
    ($span:expr, $fmt:expr, $($args:expr),*) => { ... };
    ($span:expr, $msg:expr) => { ... };
    ($err:expr) => { ... };
}
Expand description

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:

  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…