Skip to content

Commit ea175b2

Browse files
raxyteojeda
authored andcommitted
rust: update dbg!() to format column number
In Rust 1.76.0, the `dbg!()` macro was updated to also format the column number. The reason cited was usage of a few characters worth of horizontal space while allowing direct jumps to the source location. [1] Link: rust-lang/rust#114962 [1] Link: Rust-for-Linux#1065 Signed-off-by: Raghav Narang <[email protected]> Reviewed-by: Trevor Gross <[email protected]> Reviewed-by: Gary Guo <[email protected]> Link: https://lore.kernel.org/r/[email protected] [ Fixed commit author name and removed spurious newline in message. - Miguel ] Signed-off-by: Miguel Ojeda <[email protected]>
1 parent 8437313 commit ea175b2

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

rust/kernel/std_vendor.rs

+4-3
Original file line numberDiff line numberDiff line change
@@ -146,15 +146,16 @@ macro_rules! dbg {
146146
// `$val` expression could be a block (`{ .. }`), in which case the `pr_info!`
147147
// will be malformed.
148148
() => {
149-
$crate::pr_info!("[{}:{}]\n", ::core::file!(), ::core::line!())
149+
$crate::pr_info!("[{}:{}:{}]\n", ::core::file!(), ::core::line!(), ::core::column!())
150150
};
151151
($val:expr $(,)?) => {
152152
// Use of `match` here is intentional because it affects the lifetimes
153153
// of temporaries - https://stackoverflow.com/a/48732525/1063961
154154
match $val {
155155
tmp => {
156-
$crate::pr_info!("[{}:{}] {} = {:#?}\n",
157-
::core::file!(), ::core::line!(), ::core::stringify!($val), &tmp);
156+
$crate::pr_info!("[{}:{}:{}] {} = {:#?}\n",
157+
::core::file!(), ::core::line!(), ::core::column!(),
158+
::core::stringify!($val), &tmp);
158159
tmp
159160
}
160161
}

0 commit comments

Comments
 (0)