mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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] rust: pin-init: internal: pin_data: use HRTB to work around `trivial_bounds` for `Unpin`
Date: Fri, 25 Sep 2026 12:43:27 +0100	[thread overview]
Message-ID: <DLODCZ4H8YOQ.1TVPHD847WAUX@garyguo.net> (raw)
In-Reply-To: <20260922211320.1390159-1-gary@kernel.org>

On Tue Sep 22, 2026 at 10:13 PM BST, Gary Guo wrote:
> From: Gary Guo <gary@garyguo.net>
>
> `#[pin_data]` generates a `Unpin` implementation for the user, which
> requires reasoning using field types. This is rejected by rustc as "trivial
> bounds", which can only be specified using the
> `#![feature(trivial_bounds)]`.
>
> Currently we use an extra lifetime in `__Unpin` to work around this; use
> HRTB to introduce a dummy lifetime can achieve the same, which the
> `Zeroable` implementation already uses.
>
> Unify the `Unpin` impl to also use the same HRTB trick that `Zeroable`
> uses. This produces slightly better error message and slightly shorter
> expansion.
>
> Signed-off-by: Gary Guo <gary@garyguo.net>

Applied to pin-init-next.

Best,
Gary

> ---
>  rust/pin-init/internal/src/pin_data.rs | 35 +++++++++-----------------
>  rust/pin-init/src/__internal.rs        | 16 ------------
>  2 files changed, 12 insertions(+), 39 deletions(-)

      reply	other threads:[~2026-09-25 11:43 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-22 21:13 Gary Guo
2026-09-25 11:43 ` 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=DLODCZ4H8YOQ.1TVPHD847WAUX@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®