Re: [PATCH] rust: devres: add 'static bound to Devres<T>
From: Gary Guo
Date: Wed May 27 2026 - 14:14:36 EST
On Wed May 27, 2026 at 7:04 PM BST, Danilo Krummrich wrote:
> On Wed May 27, 2026 at 4:44 PM CEST, Gary Guo wrote:
>> On Tue May 26, 2026 at 1:04 AM BST, Danilo Krummrich wrote:
>>> Add a 'static bound to prevent storing types with borrowed data in
>>> Devres.
>>
>> The bound should be added on `Devres::new` instead.
>
> I did consider this as it is generally recommended to minimize bounds on
> structs.
>
> However, a Devres<T> with non-'static T is semantically nonsensical, not just
> unconstructible, and I think type level bound represents that better.
Technically `Devres` can contain references to the registration, which is known
to outlive the bound device.
Best,
Gary