From: "Gary Guo" <gary@garyguo.net>
To: "Miguel Ojeda" <miguel.ojeda.sandonis@gmail.com>,
"Gary Guo" <gary@garyguo.net>
Cc: "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>,
"Mohamad Alsadhan" <mo@sdhn.cc>,
rust-for-linux@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] rust: pin-init: use irrefutable pattern for `stack_pin_init`
Date: Tue, 01 Sep 2026 01:22:10 +0100 [thread overview]
Message-ID: <DL3JU9MZGA18.3FU1H09HEPS99@garyguo.net> (raw)
In-Reply-To: <CANiq72nKwM5n5vKWAmSiMEtUpsL=rAKpwuSa7bxM-CSVT7+N+w@mail.gmail.com>
On Tue Sep 1, 2026 at 12:58 AM BST, Miguel Ojeda wrote:
> On Fri, Aug 28, 2026 at 5:50 PM Gary Guo <gary@kernel.org> wrote:
>>
>> From: Gary Guo <gary@garyguo.net>
>>
>> In Rust 1.100.0, `Infallible` will become an alias of `!`. The let
>> binding in `stack_pin_init` will thus become unreachable and produce a
>> "unreachable expression" warning for subsequent match, and thus will fail
>> `-Dwarnings` build. For this macro, all we need to know is that the error
>> type is uninhabited, so replace this with a irrefutable pattern instead.
>>
>> Reported-by: Mohamad Alsadhan <mo@sdhn.cc>
>> Closes: https://github.com/Rust-for-Linux/pin-init/pull/171
>> Signed-off-by: Gary Guo <gary@garyguo.net>
>
> Applied to `rust-fixes` -- thanks!
>
> For stable, we will need a custom backport without
> `feature(min_exhaustive_patterns)` (we could in principle enable that
> one since it is available in Rust 1.77.0, but for stable I would avoid
> it), so I wrote this tag:
We can probably just allow `unreachable_code`?
Best,
Gary
>
> Cc: stable@vger.kernel.org # Needed in 7.1.y and later (for 6.12.y
> and 6.18.y a custom one is needed).
>
> [ The error looks like (dummy reproducer):
>
> error: unreachable expression
> --> rust/kernel/sync.rs:177:5
> |
> 177 | pin_init::stack_pin_init!(let num = 42u32);
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> | |
> | unreachable expression
> | any code following this expression is unreachable
> |
> = note: `-D unreachable-code` implied by `-D warnings`
> = help: to override `-D warnings` add `#[allow(unreachable_code)]`
> = note: this error originates in the macro
> `pin_init::stack_pin_init` (in Nightly builds, run with -Z
> macro-backtrace for more info)
>
> - Miguel ]
>
> [ Reworded for typos. - Miguel ]
>
> Cheers,
> Miguel
next prev parent reply other threads:[~2026-09-01 0:22 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-08-28 15:50 [PATCH] rust: pin-init: use irrefutable pattern for `stack_pin_init` Gary Guo
2026-08-28 15:54 ` Miguel Ojeda
2026-08-31 23:58 ` Miguel Ojeda
2026-09-01 0:22 ` Gary Guo [this message]
2026-09-01 0:27 ` 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=DL3JU9MZGA18.3FU1H09HEPS99@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=miguel.ojeda.sandonis@gmail.com \
--cc=mo@sdhn.cc \
--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