mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Gary Guo" <gary@garyguo.net>
To: "Aary Milind Kinge" <kingeaary@gmail.com>,
	"Miguel Ojeda" <ojeda@kernel.org>
Cc: "Alice Ryhl" <aliceryhl@google.com>,
	<rust-for-linux@vger.kernel.org>, <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] rust: devres: use compile-time type_name for debug info
Date: Wed, 27 May 2026 12:01:25 +0100	[thread overview]
Message-ID: <DITEOVJASZCH.21TYX8VM4I64@garyguo.net> (raw)
In-Reply-To: <20260526094329.533943-1-kingeaary@gmail.com>

On Tue May 26, 2026 at 10:43 AM BST, Aary Milind Kinge wrote:
> From: Not-Buddy <kingeaary@gmail.com>
>
> The devres_set_node_dbginfo function previously used a hardcoded
> c"Devres<T>" string for all device resource nodes because
> core::any::type_name was not stabilized as a const fn. This made
> debugging device resources difficult as all nodes shared the same name.
>
> Enable the `const_type_name` unstable feature in the `kernel` crate
> and replace the hardcoded placeholder with the actual generic type
> name at compile time.

NACK. The feature is not stable on latest rustc and is unclear that it is
planned to be stabilised, so we cannot just enable and use it.

If you want to enable this feature for kernel, you should first try to help
moving the stabilization forward on the Rust side.

Thanks,
Gary

>
> To satisfy the C-API's requirement for a null-terminated string, the
> bytes are copied into a locally evaluated const array buffer, appended
> with a null byte, and promoted to static read-only memory by reference
> before being passed to devres_set_node_dbginfo.
>
> Signed-off-by: Aary Milind Kinge <kingeaary@gmail.com>
> ---
>  rust/kernel/devres.rs | 41 ++++++++++++++++++++++++++++++++++++++---
>  rust/kernel/lib.rs    |  1 +
>  2 files changed, 39 insertions(+), 3 deletions(-)

  parent reply	other threads:[~2026-05-27 11:01 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-26  9:43 Aary Milind Kinge
2026-05-26 11:58 ` [PATCH v2] rust: devres: optimize type name allocation and fix truncation Aary Milind Kinge
2026-05-26 12:37   ` Miguel Ojeda
2026-05-26 15:03     ` David Laight
2026-05-26 16:19   ` Greg KH
2026-05-27 10:50     ` Aary Kinge
2026-05-27 11:01 ` Gary Guo [this message]
2026-05-27 11:25   ` [PATCH] rust: devres: use compile-time type_name for debug info Miguel Ojeda

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=DITEOVJASZCH.21TYX8VM4I64@garyguo.net \
    --to=gary@garyguo.net \
    --cc=aliceryhl@google.com \
    --cc=kingeaary@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    /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

Powered by JetHome