[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <DC09SG6IXEOG.3Q8DMJF5E7QBO@kernel.org>
Date: Tue, 12 Aug 2025 09:27:50 +0200
From: "Benno Lossin" <lossin@...nel.org>
To: "Tamir Duberstein" <tamird@...il.com>, "Miguel Ojeda"
<ojeda@...nel.org>, "Alex Gaynor" <alex.gaynor@...il.com>, "Boqun Feng"
<boqun.feng@...il.com>, "Gary Guo" <gary@...yguo.net>,
Björn Roy Baron <bjorn3_gh@...tonmail.com>, "Andreas
Hindborg" <a.hindborg@...nel.org>, "Alice Ryhl" <aliceryhl@...gle.com>,
"Trevor Gross" <tmgross@...ch.edu>, "Danilo Krummrich" <dakr@...nel.org>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>, "Rafael J. Wysocki"
<rafael@...nel.org>, "Luis Chamberlain" <mcgrof@...nel.org>, "Russ Weight"
<russ.weight@...ux.dev>, "Peter Zijlstra" <peterz@...radead.org>, "Ingo
Molnar" <mingo@...hat.com>, "Will Deacon" <will@...nel.org>, "Waiman Long"
<longman@...hat.com>, "Nathan Chancellor" <nathan@...nel.org>, "Nick
Desaulniers" <nick.desaulniers+lkml@...il.com>, "Bill Wendling"
<morbo@...gle.com>, "Justin Stitt" <justinstitt@...gle.com>, "Christian
Brauner" <brauner@...nel.org>
Cc: <rust-for-linux@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<llvm@...ts.linux.dev>
Subject: Re: [PATCH v14 2/3] rust: support formatting of foreign types
On Thu Jul 10, 2025 at 4:53 PM CEST, Tamir Duberstein wrote:
> Introduce a `fmt!` macro which wraps all arguments in
> `kernel::fmt::Adapter` and a `kernel::fmt::Display` trait. This enables
> formatting of foreign types (like `core::ffi::CStr`) that do not
> implement `core::fmt::Display` due to concerns around lossy conversions
> which do not apply in the kernel.
>
> Suggested-by: Alice Ryhl <aliceryhl@...gle.com>
> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/288089-General/topic/Custom.20formatting/with/516476467
> Acked-by: Greg Kroah-Hartman <gregkh@...uxfoundation.org>
> Reviewed-by: Alice Ryhl <aliceryhl@...gle.com>
> Signed-off-by: Tamir Duberstein <tamird@...il.com>
I'm not 100% sure we need to always use `first_span`, but it's probably
fine.
Reviewed-by: Benno Lossin <lossin@...nel.org>
---
Cheers,
Benno
> ---
> rust/kernel/fmt.rs | 87 +++++++++++++++++++++++++++++++++++++++++++++-
> rust/kernel/prelude.rs | 3 +-
> rust/macros/fmt.rs | 94 ++++++++++++++++++++++++++++++++++++++++++++++++++
> rust/macros/lib.rs | 19 ++++++++++
> rust/macros/quote.rs | 7 ++++
> 5 files changed, 207 insertions(+), 3 deletions(-)
Powered by blists - more mailing lists