From: "Gary Guo" <gary@garyguo.net>
To: "Gary Guo" <gary@garyguo.net>, "Benno Lossin" <lossin@kernel.org>,
"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: Re: [PATCH 0/3] rust: pin-init: provide better span for diagnostics
Date: Fri, 18 Sep 2026 12:53:21 +0100 [thread overview]
Message-ID: <DLIF6QOTMWNI.15E2WHG0VI4MP@garyguo.net> (raw)
In-Reply-To: <20260916-dev-hygiene-v1-0-dfb6ae2588ba@garyguo.net>
On Wed Sep 16, 2026 at 1:11 PM BST, Gary Guo wrote:
> When initializing a field, pin-init first projects the full slot to a slot
> of the field, then initialize it by invoking a method. Currently the span
> location is not explicitly set, so the error message points to the full
> macro invocation.
>
> Improve it by provide a span, so Rust will point to the specific fields
> causing the error when type check fails.
>
> Old error message:
>
> error[E0308]: mismatched types
> --> tests/ui/compile-fail/init/field_value_wrong_type.rs:8:28
> |
> 8 | let _ = init!(Foo { a: () });
> | ---------------^^---
> | | |
> | | expected `usize`, found `()`
> | arguments to this method are incorrect
>
> New error message:
>
> error[E0308]: mismatched types
> --> tests/ui/compile-fail/init/field_value_wrong_type.rs:8:28
> |
> 8 | let _ = init!(Foo { a: () });
> | ---^^
> | | |
> | | expected `usize`, found `()`
> | arguments to this method are incorrect
>
> ---
> Gary Guo (4):
> rust: pin-init: internal: init: emit `slot` using mixed site hygiene
> rust: pin-init: internal: init: use `slot` identifier directly with mixed site
> rust: pin-init: internal: init: provide span for slot projection
> rust: pin-init: internal: use span of Index for generated identifiers
Applied to pin-init-next.
Best,
Gary
prev parent reply other threads:[~2026-09-18 11:53 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-16 12:11 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 ` [PATCH 4/3] rust: pin-init: util: use span of `Index` for generated identifiers Gary Guo
2026-09-18 11:53 ` Gary Guo [this message]
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=DLIF6QOTMWNI.15E2WHG0VI4MP@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®