Re: [PATCH v3 17/27] rust: auxiliary: generalize Registration over ForLt
From: Gary Guo
Date: Tue May 19 2026 - 07:46:27 EST
On Tue May 19, 2026 at 11:39 AM BST, Danilo Krummrich wrote:
> On Tue May 19, 2026 at 9:56 AM CEST, Eliot Courtney wrote:
>> For example, in the next patch on the sample aux driver you can do:
>>
>> ```
>> let data = adev.registration_data::<ForLt!(for<'a> Data<'static>)>()?;
>> let pdev: &'static pci::Device<Bound> = data.parent;
>> ```
>>
>> and mint a 'static reference to a bound device, which seems unsound to
>> me.
>
> Good catch, I applied the fix.
>
> Additionally, we could probably reject unused lifetime binders in the ForLt!()
> macro, which doesn't help when used with a type alias, but may be a good
> defensive measure anyway.
That won't work, `ForLt!(T)` is basically not using the lifetime binder, and you
do need that to work.
Best,
Gary
>
>> What about requiring all device ids declared to be supported by an aux
>> bus driver to have the same rust registration data type?
>
> Please see [1] and [2].
>
> Thanks,
> Danilo
>
> [1] https://lore.kernel.org/driver-core/DIFBME3GXDC0.14UHJTPD6TTAE@xxxxxxxxxx/
> [2] https://lore.kernel.org/driver-core/DIFXM2N21Q5J.2RIYLU11C5FR6@xxxxxxxxxx/