* [PATCH] rust: update `dbg!()` to format column number
@ 2024-04-14 13:19 dev
2024-04-16 5:58 ` Trevor Gross
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: dev @ 2024-04-14 13:19 UTC (permalink / raw)
To: ojeda, alex.gaynor, wedsonaf, boqun.feng, gary, bjorn3_gh,
benno.lossin, a.hindborg, aliceryhl, dev, rust-for-linux,
linux-kernel
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: https://github.com/rust-lang/rust/pull/114962 [1]
Link: https://github.com/Rust-for-Linux/linux/issues/1065
Signed-off-by: Raghav Narang <dev@raxyte.com>
---
Branch rust-next
rust/kernel/std_vendor.rs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/std_vendor.rs b/rust/kernel/std_vendor.rs
index 388d6a514..39679a960 100644
--- a/rust/kernel/std_vendor.rs
+++ b/rust/kernel/std_vendor.rs
@@ -146,15 +146,16 @@ macro_rules! dbg {
// `$val` expression could be a block (`{ .. }`), in which case the `pr_info!`
// will be malformed.
() => {
- $crate::pr_info!("[{}:{}]\n", ::core::file!(), ::core::line!())
+ $crate::pr_info!("[{}:{}:{}]\n", ::core::file!(), ::core::line!(), ::core::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::pr_info!("[{}:{}] {} = {:#?}\n",
- ::core::file!(), ::core::line!(), ::core::stringify!($val), &tmp);
+ $crate::pr_info!("[{}:{}:{}] {} = {:#?}\n",
+ ::core::file!(), ::core::line!(), ::core::column!(),
+ ::core::stringify!($val), &tmp);
tmp
}
}
base-commit: 8db31d3f3bd5dbc8cf3a22bba04b4b4add7f984e
--
2.44.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] rust: update `dbg!()` to format column number
2024-04-14 13:19 [PATCH] rust: update `dbg!()` to format column number dev
@ 2024-04-16 5:58 ` Trevor Gross
2024-04-16 9:34 ` Miguel Ojeda
2024-04-17 13:50 ` Gary Guo
2024-05-05 22:28 ` Miguel Ojeda
2 siblings, 1 reply; 6+ messages in thread
From: Trevor Gross @ 2024-04-16 5:58 UTC (permalink / raw)
To: dev
Cc: ojeda, alex.gaynor, wedsonaf, boqun.feng, gary, bjorn3_gh,
benno.lossin, a.hindborg, aliceryhl, rust-for-linux,
linux-kernel
On Sun, Apr 14, 2024 at 9:31 AM <dev@raxyte.com> wrote:
>
> 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: https://github.com/rust-lang/rust/pull/114962 [1]
> Link: https://github.com/Rust-for-Linux/linux/issues/1065
The second link could be "Fixes: ..." (but whoever picks this up can
probably do that)
> Signed-off-by: Raghav Narang <dev@raxyte.com>
Reviewed-by: Trevor Gross <tmgross@umich.edu>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust: update `dbg!()` to format column number
2024-04-16 5:58 ` Trevor Gross
@ 2024-04-16 9:34 ` Miguel Ojeda
0 siblings, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2024-04-16 9:34 UTC (permalink / raw)
To: Trevor Gross
Cc: dev, ojeda, alex.gaynor, wedsonaf, boqun.feng, gary, bjorn3_gh,
benno.lossin, a.hindborg, aliceryhl, rust-for-linux,
linux-kernel
On Tue, Apr 16, 2024 at 7:58 AM Trevor Gross <tmgross@umich.edu> wrote:
>
> The second link could be "Fixes: ..." (but whoever picks this up can
> probably do that)
`Fixes:` references a commit, not a URL. I think you meant `Closes:`,
but that one in turn is meant for bug fixes, which does not really fit
either. That is why I suggested `Link:` in the issue instead.
> Reviewed-by: Trevor Gross <tmgross@umich.edu>
Thanks!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust: update `dbg!()` to format column number
2024-04-14 13:19 [PATCH] rust: update `dbg!()` to format column number dev
2024-04-16 5:58 ` Trevor Gross
@ 2024-04-17 13:50 ` Gary Guo
2024-05-05 22:28 ` Miguel Ojeda
2 siblings, 0 replies; 6+ messages in thread
From: Gary Guo @ 2024-04-17 13:50 UTC (permalink / raw)
To: dev
Cc: ojeda, alex.gaynor, wedsonaf, boqun.feng, bjorn3_gh,
benno.lossin, a.hindborg, aliceryhl, rust-for-linux,
linux-kernel
On Sun, 14 Apr 2024 18:49:28 +0530
<dev@raxyte.com> wrote:
> 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: https://github.com/rust-lang/rust/pull/114962 [1]
> Link: https://github.com/Rust-for-Linux/linux/issues/1065
>
> Signed-off-by: Raghav Narang <dev@raxyte.com>
Reviewed-by: Gary Guo <gary@garyguo.net>
> ---
> Branch rust-next
>
> rust/kernel/std_vendor.rs | 7 ++++---
> 1 file changed, 4 insertions(+), 3 deletions(-)
>
> diff --git a/rust/kernel/std_vendor.rs b/rust/kernel/std_vendor.rs
> index 388d6a514..39679a960 100644
> --- a/rust/kernel/std_vendor.rs
> +++ b/rust/kernel/std_vendor.rs
> @@ -146,15 +146,16 @@ macro_rules! dbg {
> // `$val` expression could be a block (`{ .. }`), in which case the `pr_info!`
> // will be malformed.
> () => {
> - $crate::pr_info!("[{}:{}]\n", ::core::file!(), ::core::line!())
> + $crate::pr_info!("[{}:{}:{}]\n", ::core::file!(), ::core::line!(), ::core::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::pr_info!("[{}:{}] {} = {:#?}\n",
> - ::core::file!(), ::core::line!(), ::core::stringify!($val), &tmp);
> + $crate::pr_info!("[{}:{}:{}] {} = {:#?}\n",
> + ::core::file!(), ::core::line!(), ::core::column!(),
> + ::core::stringify!($val), &tmp);
> tmp
> }
> }
>
> base-commit: 8db31d3f3bd5dbc8cf3a22bba04b4b4add7f984e
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] rust: update `dbg!()` to format column number
2024-04-14 13:19 [PATCH] rust: update `dbg!()` to format column number dev
2024-04-16 5:58 ` Trevor Gross
2024-04-17 13:50 ` Gary Guo
@ 2024-05-05 22:28 ` Miguel Ojeda
2 siblings, 0 replies; 6+ messages in thread
From: Miguel Ojeda @ 2024-05-05 22:28 UTC (permalink / raw)
To: dev
Cc: ojeda, alex.gaynor, wedsonaf, boqun.feng, gary, bjorn3_gh,
benno.lossin, a.hindborg, aliceryhl, rust-for-linux,
linux-kernel
On Sun, Apr 14, 2024 at 3:21 PM <dev@raxyte.com> wrote:
>
> 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: https://github.com/rust-lang/rust/pull/114962 [1]
> Link: https://github.com/Rust-for-Linux/linux/issues/1065
>
> Signed-off-by: Raghav Narang <dev@raxyte.com>
The commit author was:
dev@raxyte.com <dev@raxyte.com>
and I fixed it to:
Raghav Narang <dev@raxyte.com>
i.e. with the name from the Signed-off-by line. If this is not
correct, please let me know!
[ Fixed commit author name and removed spurious newline in message. - Miguel ]
Applied to `rust-next` -- thanks everyone!
Cheers,
Miguel
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH] rust: update `dbg!()` to format column number
@ 2024-04-14 13:19 dev
0 siblings, 0 replies; 6+ messages in thread
From: dev @ 2024-04-14 13:19 UTC (permalink / raw)
To: ojeda, alex.gaynor, wedsonaf, boqun.feng, gary, bjorn3_gh,
benno.lossin, a.hindborg, aliceryhl, dev, rust-for-linux,
linux-kernel
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: https://github.com/rust-lang/rust/pull/114962 [1]
Link: https://github.com/Rust-for-Linux/linux/issues/1065
Signed-off-by: Raghav Narang <dev@raxyte.com>
---
Branch rust-next
rust/kernel/std_vendor.rs | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/rust/kernel/std_vendor.rs b/rust/kernel/std_vendor.rs
index 388d6a514..39679a960 100644
--- a/rust/kernel/std_vendor.rs
+++ b/rust/kernel/std_vendor.rs
@@ -146,15 +146,16 @@ macro_rules! dbg {
// `$val` expression could be a block (`{ .. }`), in which case the `pr_info!`
// will be malformed.
() => {
- $crate::pr_info!("[{}:{}]\n", ::core::file!(), ::core::line!())
+ $crate::pr_info!("[{}:{}:{}]\n", ::core::file!(), ::core::line!(), ::core::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::pr_info!("[{}:{}] {} = {:#?}\n",
- ::core::file!(), ::core::line!(), ::core::stringify!($val), &tmp);
+ $crate::pr_info!("[{}:{}:{}] {} = {:#?}\n",
+ ::core::file!(), ::core::line!(), ::core::column!(),
+ ::core::stringify!($val), &tmp);
tmp
}
}
base-commit: 8db31d3f3bd5dbc8cf3a22bba04b4b4add7f984e
--
2.44.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
end of thread, other threads:[~2024-05-05 22:29 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-04-14 13:19 [PATCH] rust: update `dbg!()` to format column number dev
2024-04-16 5:58 ` Trevor Gross
2024-04-16 9:34 ` Miguel Ojeda
2024-04-17 13:50 ` Gary Guo
2024-05-05 22:28 ` Miguel Ojeda
-- strict thread matches above, loose matches on Subject: below --
2024-04-14 13:19 dev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.