Re: [PATCH v3 6/7] rust: pci: return DevresLt from Bar::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 Bar<'static, SIZE> so that > DevresLt can shorten the stored 'static lifetime back to the caller's > borrow lifetime. > > CovariantForLt is sound because Bar<'a, SIZE> only holds &'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 Bar<'static>. > > Add a DevresBar<SIZE> type alias for convenience. > > Signed-off-by: Danilo Krummrich <[email protected]> Reviewed-by: Alexandre Courbot <[email protected]>