Output line column info when panicking
This commit is contained in:
parent
c3a130cffc
commit
da887074fc
9 changed files with 207 additions and 54 deletions
|
@ -17,16 +17,18 @@ macro_rules! panic {
|
|||
panic!("explicit panic")
|
||||
);
|
||||
($msg:expr) => ({
|
||||
static _MSG_FILE_LINE: (&'static str, &'static str, u32) = ($msg, file!(), line!());
|
||||
$crate::panicking::panic(&_MSG_FILE_LINE)
|
||||
static _MSG_FILE_LINE_COL: (&'static str, &'static str, u32, u32) =
|
||||
($msg, file!(), line!(), column!());
|
||||
$crate::panicking::panic_new(&_MSG_FILE_LINE_COL)
|
||||
});
|
||||
($fmt:expr, $($arg:tt)*) => ({
|
||||
// The leading _'s are to avoid dead code warnings if this is
|
||||
// used inside a dead function. Just `#[allow(dead_code)]` is
|
||||
// insufficient, since the user may have
|
||||
// `#[forbid(dead_code)]` and which cannot be overridden.
|
||||
static _FILE_LINE: (&'static str, u32) = (file!(), line!());
|
||||
$crate::panicking::panic_fmt(format_args!($fmt, $($arg)*), &_FILE_LINE)
|
||||
static _MSG_FILE_LINE_COL: (&'static str, u32, u32) =
|
||||
(file!(), line!(), column!());
|
||||
$crate::panicking::panic_fmt_new(format_args!($fmt, $($arg)*), &_MSG_FILE_LINE_COL)
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue