public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rust: fix formatting expressions
@ 2026-01-04 13:00 ` Tamir Duberstein
  2026-01-04 13:02   ` Alice Ryhl
                     ` (4 more replies)
  0 siblings, 5 replies; 7+ messages in thread
From: Tamir Duberstein @ 2026-01-04 13:00 UTC (permalink / raw)
  To: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Greg Kroah-Hartman
  Cc: rust-for-linux, linux-kernel, Tamir Duberstein, Janne Grunau

From: Tamir Duberstein <tamird@gmail.com>

Allow usage like `pr_info!("one + 1 = {}", one + 1)` to compile by
ensuring that a reference is taken to the entire expression.

Fixes: c5cf01ba8dfe ("rust: support formatting of foreign types")
Reported-by: Janne Grunau <j@jannau.net>
Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Custom.20formatting/near/566219493
---
Signed-off-by: Tamir Duberstein <tamird@gmail.com>
---
 rust/macros/fmt.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/macros/fmt.rs b/rust/macros/fmt.rs
index 2f4b9f6e2211..8354abd54502 100644
--- a/rust/macros/fmt.rs
+++ b/rust/macros/fmt.rs
@@ -67,7 +67,7 @@ pub(crate) fn fmt(input: TokenStream) -> TokenStream {
                     }
                     (None, acc)
                 })();
-                args.extend(quote_spanned!(first_span => #lhs #adapter(&#rhs)));
+                args.extend(quote_spanned!(first_span => #lhs #adapter(&(#rhs))));
             }
         };
 

---
base-commit: f8f9c1f4d0c7a64600e2ca312dec824a0bc2f1da
change-id: 20260104-fmt-paren-e92eb804a4aa

Best regards,
--  
Tamir Duberstein <tamird@gmail.com>


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] rust: fix formatting expressions
  2026-01-04 13:00 ` [PATCH] rust: fix formatting expressions Tamir Duberstein
@ 2026-01-04 13:02   ` Alice Ryhl
  2026-01-04 13:02   ` Miguel Ojeda
                     ` (3 subsequent siblings)
  4 siblings, 0 replies; 7+ messages in thread
From: Alice Ryhl @ 2026-01-04 13:02 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Trevor Gross, Danilo Krummrich,
	Greg Kroah-Hartman, rust-for-linux, linux-kernel,
	Tamir Duberstein, Janne Grunau

On Sun, Jan 4, 2026 at 2:00 PM Tamir Duberstein <tamird@kernel.org> wrote:
>
> From: Tamir Duberstein <tamird@gmail.com>
>
> Allow usage like `pr_info!("one + 1 = {}", one + 1)` to compile by
> ensuring that a reference is taken to the entire expression.
>
> Fixes: c5cf01ba8dfe ("rust: support formatting of foreign types")
> Reported-by: Janne Grunau <j@jannau.net>
> Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Custom.20formatting/near/566219493
> ---
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

Reviewed-by: Alice Ryhl <aliceryhl@google.com>

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rust: fix formatting expressions
  2026-01-04 13:00 ` [PATCH] rust: fix formatting expressions Tamir Duberstein
  2026-01-04 13:02   ` Alice Ryhl
@ 2026-01-04 13:02   ` Miguel Ojeda
  2026-01-04 13:21     ` Tamir Duberstein
  2026-01-04 13:05   ` Janne Grunau
                     ` (2 subsequent siblings)
  4 siblings, 1 reply; 7+ messages in thread
From: Miguel Ojeda @ 2026-01-04 13:02 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Greg Kroah-Hartman, rust-for-linux,
	linux-kernel, Tamir Duberstein, Janne Grunau

On Sun, Jan 4, 2026 at 2:00 PM Tamir Duberstein <tamird@kernel.org> wrote:
>
> Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Custom.20formatting/near/566219493
> ---
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

Thanks Tamir, I will pick it into `rust-fixes` alongside a bunch of
other pending fixes.

Quick note in case you want to double-check your scripts: somehow you
ended up with two `---` lines and thus the SoB outside (no need to
resend).

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rust: fix formatting expressions
  2026-01-04 13:00 ` [PATCH] rust: fix formatting expressions Tamir Duberstein
  2026-01-04 13:02   ` Alice Ryhl
  2026-01-04 13:02   ` Miguel Ojeda
@ 2026-01-04 13:05   ` Janne Grunau
  2026-01-04 22:55   ` Miguel Ojeda
  2026-01-14 11:28   ` Andreas Hindborg
  4 siblings, 0 replies; 7+ messages in thread
From: Janne Grunau @ 2026-01-04 13:05 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Greg Kroah-Hartman, rust-for-linux,
	linux-kernel, Tamir Duberstein

On Sun, Jan 04, 2026 at 08:00:27AM -0500, Tamir Duberstein wrote:
> From: Tamir Duberstein <tamird@gmail.com>
> 
> Allow usage like `pr_info!("one + 1 = {}", one + 1)` to compile by
> ensuring that a reference is taken to the entire expression.
> 
> Fixes: c5cf01ba8dfe ("rust: support formatting of foreign types")
> Reported-by: Janne Grunau <j@jannau.net>
> Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Custom.20formatting/near/566219493
> ---
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>
> ---
>  rust/macros/fmt.rs | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/rust/macros/fmt.rs b/rust/macros/fmt.rs
> index 2f4b9f6e2211..8354abd54502 100644
> --- a/rust/macros/fmt.rs
> +++ b/rust/macros/fmt.rs
> @@ -67,7 +67,7 @@ pub(crate) fn fmt(input: TokenStream) -> TokenStream {
>                      }
>                      (None, acc)
>                  })();
> -                args.extend(quote_spanned!(first_span => #lhs #adapter(&#rhs)));
> +                args.extend(quote_spanned!(first_span => #lhs #adapter(&(#rhs))));
>              }
>          };
>  

thanks, this fixes the trivial example I added to rust_minimal.rs and
all out-of-tree use in the asahi driver where I discovered the issue.

Tested-by: Janne Grunau <j@jannau.net>
Reviewed-by: Janne Grunau <j@jannau.net>

Janne

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rust: fix formatting expressions
  2026-01-04 13:02   ` Miguel Ojeda
@ 2026-01-04 13:21     ` Tamir Duberstein
  0 siblings, 0 replies; 7+ messages in thread
From: Tamir Duberstein @ 2026-01-04 13:21 UTC (permalink / raw)
  To: Miguel Ojeda
  Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Greg Kroah-Hartman, rust-for-linux,
	linux-kernel, Janne Grunau

On Sun, Jan 4, 2026 at 8:02 AM Miguel Ojeda
<miguel.ojeda.sandonis@gmail.com> wrote:
>
> On Sun, Jan 4, 2026 at 2:00 PM Tamir Duberstein <tamird@kernel.org> wrote:
> >
> > Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Custom.20formatting/near/566219493
> > ---
> > Signed-off-by: Tamir Duberstein <tamird@gmail.com>
>
> Thanks Tamir, I will pick it into `rust-fixes` alongside a bunch of
> other pending fixes.
>
> Quick note in case you want to double-check your scripts: somehow you
> ended up with two `---` lines and thus the SoB outside (no need to
> resend).
>
> Cheers,
> Miguel

Ah thanks for calling out - I think I just forgot to SoB the commit
and so this came from the (empty) cover letter.

Thanks!
Tamir

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rust: fix formatting expressions
  2026-01-04 13:00 ` [PATCH] rust: fix formatting expressions Tamir Duberstein
                     ` (2 preceding siblings ...)
  2026-01-04 13:05   ` Janne Grunau
@ 2026-01-04 22:55   ` Miguel Ojeda
  2026-01-14 11:28   ` Andreas Hindborg
  4 siblings, 0 replies; 7+ messages in thread
From: Miguel Ojeda @ 2026-01-04 22:55 UTC (permalink / raw)
  To: Tamir Duberstein
  Cc: Miguel Ojeda, Boqun Feng, Gary Guo, Björn Roy Baron,
	Benno Lossin, Andreas Hindborg, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Greg Kroah-Hartman, rust-for-linux,
	linux-kernel, Tamir Duberstein, Janne Grunau

On Sun, Jan 4, 2026 at 2:00 PM Tamir Duberstein <tamird@kernel.org> wrote:
>
> From: Tamir Duberstein <tamird@gmail.com>
>
> Allow usage like `pr_info!("one + 1 = {}", one + 1)` to compile by
> ensuring that a reference is taken to the entire expression.
>
> Fixes: c5cf01ba8dfe ("rust: support formatting of foreign types")
> Reported-by: Janne Grunau <j@jannau.net>
> Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Custom.20formatting/near/566219493
> ---
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>

Applied to `rust-fixes` -- thanks everyone!

    [ Added Signed-off-by back. Reworded title. - Miguel ]

Cheers,
Miguel

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] rust: fix formatting expressions
  2026-01-04 13:00 ` [PATCH] rust: fix formatting expressions Tamir Duberstein
                     ` (3 preceding siblings ...)
  2026-01-04 22:55   ` Miguel Ojeda
@ 2026-01-14 11:28   ` Andreas Hindborg
  4 siblings, 0 replies; 7+ messages in thread
From: Andreas Hindborg @ 2026-01-14 11:28 UTC (permalink / raw)
  To: Tamir Duberstein, Miguel Ojeda, Boqun Feng, Gary Guo,
	Björn Roy Baron, Benno Lossin, Alice Ryhl, Trevor Gross,
	Danilo Krummrich, Greg Kroah-Hartman
  Cc: rust-for-linux, linux-kernel, Tamir Duberstein, Janne Grunau

"Tamir Duberstein" <tamird@kernel.org> writes:

> From: Tamir Duberstein <tamird@gmail.com>
>
> Allow usage like `pr_info!("one + 1 = {}", one + 1)` to compile by
> ensuring that a reference is taken to the entire expression.
>
> Fixes: c5cf01ba8dfe ("rust: support formatting of foreign types")
> Reported-by: Janne Grunau <j@jannau.net>
> Closes: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Custom.20formatting/near/566219493
> ---
> Signed-off-by: Tamir Duberstein <tamird@gmail.com>


Tested-by: Andreas Hindborg <a.hindborg@kernel.org>


Best regards,
Andreas Hindborg




^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-01-14 11:29 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
     [not found] <fzJECG6tYXqKgwdDYbvu0KQoPJybIbvqho0oTcuFz8CVKSJkzYpi5MXPq4FMMtplrcb9bQiXDPtJ9XogtmhrcQ==@protonmail.internalid>
2026-01-04 13:00 ` [PATCH] rust: fix formatting expressions Tamir Duberstein
2026-01-04 13:02   ` Alice Ryhl
2026-01-04 13:02   ` Miguel Ojeda
2026-01-04 13:21     ` Tamir Duberstein
2026-01-04 13:05   ` Janne Grunau
2026-01-04 22:55   ` Miguel Ojeda
2026-01-14 11:28   ` Andreas Hindborg

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox