mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00
added column number to dbg!()
This commit is contained in:
parent
1c15b82b8a
commit
cbb36d808b
@ -355,15 +355,15 @@ macro_rules! dbg {
|
||||
// `$val` expression could be a block (`{ .. }`), in which case the `eprintln!`
|
||||
// will be malformed.
|
||||
() => {
|
||||
$crate::eprintln!("[{}:{}]", $crate::file!(), $crate::line!())
|
||||
$crate::eprintln!("[{}:{}:{}]", $crate::file!(), $crate::line!(), $crate::column!())
|
||||
};
|
||||
($val:expr $(,)?) => {
|
||||
// Use of `match` here is intentional because it affects the lifetimes
|
||||
// of temporaries - https://stackoverflow.com/a/48732525/1063961
|
||||
match $val {
|
||||
tmp => {
|
||||
$crate::eprintln!("[{}:{}] {} = {:#?}",
|
||||
$crate::file!(), $crate::line!(), $crate::stringify!($val), &tmp);
|
||||
$crate::eprintln!("[{}:{}:{}] {} = {:#?}",
|
||||
$crate::file!(), $crate::line!(), $crate::column!(), $crate::stringify!($val), &tmp);
|
||||
tmp
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user