Re: [PATCH 00/24] rust: device: Higher-Ranked Lifetime Types for device drivers

Alice Ryhl
2026-04-30T09:14:40Z

Super cool to see this!

On Tue, Apr 28, 2026 at 12:10:58AM +0200, Danilo Krummrich wrote:
> Before:
>
> struct MyDriver {
> pdev: ARef<pci::Device>,
> bar: Devres<pci::Bar<BAR_SIZE>>,
> }
>
> let io = self.bar.access(dev)?;
> io.read32(OFFSET);
>
> After:
>
> struct MyDriver<'a> {
> pdev: &'a pci::Device,
> bar: pci::Bar<'a, BAR_SIZE>,
> }
>
> self.bar.read32(OFFSET);

I think we should establish a convention for how to name the lifetime
early. Using just the generic name 'a is probably not ideal.

How about using 'dev for lifetimes that correspond to the lifetime of
the device being bound?

Alice