Re: [PATCH v3 22/27] rust: driver-core: rename 'a lifetime to 'bound

From: Danilo Krummrich

Date: Tue May 19 2026 - 13:23:25 EST


On Tue May 19, 2026 at 6:56 PM CEST, Gary Guo wrote:
> On Sun May 17, 2026 at 1:01 AM BST, Danilo Krummrich wrote:
>> - pub fn access<'a>(&'a self, dev: &'a Device<Bound>) -> Result<&'a T> {
>> + pub fn access<'bound>(&'bound self, dev: &'bound Device<Bound>) -> Result<&'bound T> {
>> if self.dev.as_raw() != dev.as_raw() {
>> return Err(EINVAL);
>> }
>
> For the same reason that I outlined in the other email, I think this should keep
> the generic `'a` name as this is not the actual lifetime of `'bound`, just a
> shortened one.

I think it depends on how you want to read it, i.e. do we consider 'bound to be:

- the lifetime for the full duration of a device bound to a driver, or
- some lifetime that guarantees that the device remains bound for (which can
also be shorter).

For this and the other cases you commented on I obviously applied the second
interpretation.

That said, I think for consistency and ambiguity reasons it does make sense to
reserve the term 'bound for the first one exclusively, and also clearly document
that.