diff options
| author | Alistair Popple <apopple@nvidia.com> | 2026-09-09 16:44:54 +1000 |
|---|---|---|
| committer | Danilo Krummrich <dakr@kernel.org> | 2026-09-27 14:02:20 +0200 |
| commit | 4075acc9d489cc6aaa37e3f4930943f32a60e7e4 (patch) | |
| tree | 99ef7236d8b44e954da3f8a76d959e3dbedb6369 /tools/lib/python/kdoc/python_version.py | |
| parent | bf91bd56fc46b5a656f1c6be629787e05965ef82 (diff) | |
rust: auxiliary: let registration_data_with() closures return covariant sub-fields
The closure passed to registration_data_with() currently receives
`Pin<&'a F::Of<'a>>` with `'a` universally quantified. This prevents the
closure from returning references derived from the registration data,
even for sub-fields that are covariant in their lifetime, because the
compiler cannot relate `'a` to any lifetime the caller knows about.
Tie the outer reference to the `&self` lifetime instead, i.e. pass
`Pin<&'this F::Of<'a>>`. This gives the closure the implied bound
`'a: 'this`, so covariant sub-fields such as `&'a T` can be coerced to
`'this` and returned directly, while invariant fields still cannot be
coerced and therefore cannot escape with an incorrect lifetime.
This allows auxiliary child drivers to project covariant data out of
invariant registration data without having to wrap every use in a
closure.
Link: https://lore.kernel.org/nova-gpu/DL3WPTVM033J.33RWYCZOC67Z1@kernel.org/
Suggested-by: Gary Guo <gary@garyguo.net>
Signed-off-by: Alistair Popple <apopple@nvidia.com>
Link: https://patch.msgid.link/20260909064506.910162-2-apopple@nvidia.com
Co-developed-by: Danilo Krummrich <dakr@kernel.org>
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
Diffstat (limited to 'tools/lib/python/kdoc/python_version.py')
0 files changed, 0 insertions, 0 deletions
