Re: [PATCH v3 7/7] rust: io: mem: return DevresLt from IoMem/ExclusiveIoMem::into_devres()
"Alexandre Courbot" <[email protected]>
| Newsgroups | dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pwm,org.kernel.vger.rust-for-linux |
|---|---|
| Message-ID | <[email protected]> |
On Fri Jun 19, 2026 at 8:08 AM JST, Danilo Krummrich wrote: > Implement ForLt and CovariantForLt for IoMem<'static, SIZE> and > ExclusiveIoMem<'static, SIZE> so that DevresLt can shorten the stored > 'static lifetime back to the caller's borrow lifetime. > > CovariantForLt is sound because both types only hold &'a Device<Bound>, > which is covariant over 'a. > > Since DevresLt::new() handles the lifetime transmutation internally, > into_devres() no longer needs an explicit transmute to 'static. > > Add DevresIoMem<SIZE> and DevresExclusiveIoMem<SIZE> type aliases. > > Signed-off-by: Danilo Krummrich <[email protected]> Reviewed-by: Alexandre Courbot <[email protected]>