mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Gary Guo <gary@garyguo.net>
To: "Benno Lossin" <lossin@kernel.org>, "Gary Guo" <gary@garyguo.net>,
	"Miguel Ojeda" <ojeda@kernel.org>,
	"Boqun Feng" <boqun@kernel.org>,
	"Björn Roy Baron" <bjorn3_gh@protonmail.com>,
	"Andreas Hindborg" <a.hindborg@kernel.org>,
	"Alice Ryhl" <aliceryhl@google.com>,
	"Trevor Gross" <tmgross@umich.edu>,
	"Danilo Krummrich" <dakr@kernel.org>,
	"Daniel Almeida" <daniel.almeida@collabora.com>,
	"Tamir Duberstein" <tamird@kernel.org>,
	"Alexandre Courbot" <acourbot@nvidia.com>,
	"Onur Özkan" <work@onurozkan.dev>
Cc: rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 4/3] rust: pin-init: util: use span of `Index` for generated identifiers
Date: Wed, 16 Sep 2026 19:41:30 +0100	[thread overview]
Message-ID: <20260916184131.435059-1-gary@garyguo.net> (raw)
In-Reply-To: <20260916-dev-hygiene-v1-0-dfb6ae2588ba@garyguo.net>

Use the span of `Index` for generated identifiers, so diagnostics can point
to the span of the index.

Signed-off-by: Gary Guo <gary@garyguo.net>
---
Follow up to also improve the diagnostics for tuple structs.
---
 rust/pin-init/internal/src/util.rs | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/rust/pin-init/internal/src/util.rs b/rust/pin-init/internal/src/util.rs
index ed2c78f0658f..0b5c28b21091 100644
--- a/rust/pin-init/internal/src/util.rs
+++ b/rust/pin-init/internal/src/util.rs
@@ -41,7 +41,7 @@ impl MemberExt for Member {
     fn as_ident(&self) -> Ident {
         match self {
             Member::Named(ident) => ident.clone(),
-            Member::Unnamed(Index { index, .. }) => format_ident!("_{index}"),
+            Member::Unnamed(Index { index, span }) => format_ident!("_{index}", span = *span),
         }
     }
 

base-commit: 3b3ff9034a497fb3b8429f6fe8ba5697bc7dcebd
prerequisite-patch-id: 84717125cba2ef134e74459d283b3206649b3b03
prerequisite-patch-id: 9f34c2d1fc9699479209cd0c98ec43a70dca8747
prerequisite-patch-id: 830ff446f1ac103336c3b30c9914e9a22c70e577
-- 
2.54.0


  parent reply	other threads:[~2026-09-16 18:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-16 12:11 [PATCH 0/3] rust: pin-init: provide better span for diagnostics Gary Guo
2026-09-16 12:11 ` [PATCH 1/3] rust: pin-init: internal: pin_init: emit `slot` using mixed site hygiene Gary Guo
2026-09-16 12:11 ` [PATCH 2/3] rust: pin-init: internal: pin_init: use `slot` identifier directly with mixed site Gary Guo
2026-09-16 12:11 ` [PATCH 3/3] rust: pin-init: internal: pin_init: provide span for slot projection Gary Guo
2026-09-16 18:41 ` Gary Guo [this message]
2026-09-18 11:53 ` [PATCH 0/3] rust: pin-init: provide better span for diagnostics Gary Guo

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=20260916184131.435059-1-gary@garyguo.net \
    --to=gary@garyguo.net \
    --cc=a.hindborg@kernel.org \
    --cc=acourbot@nvidia.com \
    --cc=aliceryhl@google.com \
    --cc=bjorn3_gh@protonmail.com \
    --cc=boqun@kernel.org \
    --cc=dakr@kernel.org \
    --cc=daniel.almeida@collabora.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lossin@kernel.org \
    --cc=ojeda@kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    --cc=tamird@kernel.org \
    --cc=tmgross@umich.edu \
    --cc=work@onurozkan.dev \
    /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®