Re: [PATCH 03/24] rust: devres: add ForLt support to Devres

Danilo Krummrich
2026-04-28T13:14:23Z

On Tue Apr 28, 2026 at 12:11 AM CEST, Danilo Krummrich wrote:
> Use ForLt::cast_ref() in Devres access methods, enabling lifetime
> shortening for types that are covariant over their lifetime parameter.
>
> This is a no-op for 'static types, but prepares Devres for use with
> lifetime-parameterized types such as pci::Bar<'_, SIZE>.
>
> Add DevresGuard as a wrapper around RevocableGuard that applies
> ForLt::cast_ref() on deref().
>
> Signed-off-by: Danilo Krummrich <dakr@kernel.org>

Please disregard this patch, it does nothing for this patch series.

It sneaked in from a subsequent series I work on which makes device resource
types, such as pci::Bar, ForLt!() types themselves.

One difficulty is that ForLt!(Bar<'_, SIZE>) fails when SIZE is a generic const
parameter, as it would require generic_const_exprs.