Re: [PATCH] rust: pin-init: use irrefutable pattern for `stack_pin_init`
From: Miguel Ojeda
Date: Mon Aug 31 2026 - 20:17:19 EST
On Fri, Aug 28, 2026 at 5:50 PM Gary Guo <gary@xxxxxxxxxx> wrote:
>
> From: Gary Guo <gary@xxxxxxxxxxx>
>
> 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@xxxxxxx>
> Closes: https://github.com/Rust-for-Linux/pin-init/pull/171
> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
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:
Cc: stable@xxxxxxxxxxxxxxx # 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