From: Tamir Duberstein <tamird@kernel.org>
To: "Miguel Ojeda" <ojeda@kernel.org>,
"Boqun Feng" <boqun.feng@gmail.com>,
"Gary Guo" <gary@garyguo.net>,
"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
"Benno Lossin" <lossin@kernel.org>,
"Andreas Hindborg" <a.hindborg@kernel.org>,
"Alice Ryhl" <aliceryhl@google.com>,
"Trevor Gross" <tmgross@umich.edu>,
"Danilo Krummrich" <dakr@kernel.org>,
"Greg Kroah-Hartman" <gregkh@linuxfoundation.org>
Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org,
Tamir Duberstein <tamird@gmail.com>, Janne Grunau <j@jannau.net>
Subject: [PATCH] rust: fix formatting expressions
Date: Sun, 04 Jan 2026 08:00:27 -0500 [thread overview]
Message-ID: <20260104-fmt-paren-v1-1-6b84bc0da78f@gmail.com> (raw)
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>
next reply other threads:[~2026-01-04 13:00 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <fzJECG6tYXqKgwdDYbvu0KQoPJybIbvqho0oTcuFz8CVKSJkzYpi5MXPq4FMMtplrcb9bQiXDPtJ9XogtmhrcQ==@protonmail.internalid>
2026-01-04 13:00 ` Tamir Duberstein [this message]
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260104-fmt-paren-v1-1-6b84bc0da78f@gmail.com \
--to=tamird@kernel.org \
--cc=a.hindborg@kernel.org \
--cc=aliceryhl@google.com \
--cc=bjorn3_gh@protonmail.com \
--cc=boqun.feng@gmail.com \
--cc=dakr@kernel.org \
--cc=gary@garyguo.net \
--cc=gregkh@linuxfoundation.org \
--cc=j@jannau.net \
--cc=linux-kernel@vger.kernel.org \
--cc=lossin@kernel.org \
--cc=ojeda@kernel.org \
--cc=rust-for-linux@vger.kernel.org \
--cc=tamird@gmail.com \
--cc=tmgross@umich.edu \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®