Re: [PATCH] rust: irq: add `'static` bounds to irq callbacks

From: Miguel Ojeda

Date: Thu Feb 19 2026 - 03:38:14 EST


On Sat, Feb 14, 2026 at 10:27 AM Benno Lossin <lossin@xxxxxxxxxx> wrote:
>
> These callback functions take a generic `T` that is used in the body as
> the generic argument in `Registration` and `ThreadedRegistration`. Those
> types require `T: 'static`, but due to a compiler bug this requirement
> isn't propagated to the function. Thus add the bound. This was caught in
> the upstream Rust CI [1].
>
> Signed-off-by: Benno Lossin <lossin@xxxxxxxxxx>
> Link: https://github.com/rust-lang/rust/pull/149389 [1]

Applied to `rust-fixes` -- thanks everyone!

Daniel: I added your Reviewed-by from the other patch (and linked to
that patch separately too) -- I hope that is OK.

[ The three errors looked similar and will start appearing with Rust
1.95.0 (expected 2026-04-16). The first one was:

error[E0310]: the parameter type `T` may not live long enough
Error: --> rust/kernel/irq/request.rs:266:43
|
266 | let registration = unsafe { &*(ptr as *const
Registration<T>) };
| ^^^^^^^^^^^^^^^^^^^^^^
| |
| the
parameter type `T` must be valid for the static lifetime...
| ...so that
the type `T` will meet its required lifetime bounds
|
help: consider adding an explicit lifetime bound
|
264 | unsafe extern "C" fn handle_irq_callback<T: Handler +
'static>(_irq: i32, ptr: *mut c_void) -> c_uint {
| +++++++++

- Miguel ]

Cheers,
Miguel