1 | // SPDX-License-Identifier: Apache-2.0 OR MIT |
---|---|
2 | |
3 | macro_rules! format_err { |
4 | ($span:expr, $msg:expr $(,)?) => { |
5 | syn::Error::new_spanned(&$span as &dyn quote::ToTokens, &$msg as &dyn core::fmt::Display) |
6 | }; |
7 | ($span:expr, $($tt:tt)*) => { |
8 | format_err!($span, format!($($tt)*)) |
9 | }; |
10 | } |
11 | |
12 | macro_rules! bail { |
13 | ($($tt:tt)*) => { |
14 | return Err(format_err!($($tt)*)) |
15 | }; |
16 | } |
17 |