linux/rust
Danilo Krummrich a56a92be1f ForLt/CovariantForLt split, auxiliary closure API and DevresLt
The ForLt trait currently guarantees covariance, which allows safe
 lifetime shortening via cast_ref(). However, some types (e.g. those
 containing Mutex<&'bound T>) are invariant over their lifetime parameter
 and cannot safely use cast_ref().
 
 This series splits ForLt into two traits:
 
   - ForLt: base trait for all lifetime-parameterized types, providing
     only the Of<'a> GAT.
 
   - CovariantForLt: unsafe subtrait that guarantees covariance,
     providing a safe cast_ref() method.
 
 For invariant types, a closure-based API (registration_data_with()) is
 added to the auxiliary subsystem. The closure's HRTB prevents the caller
 from choosing a concrete lifetime, which would be unsound for invariant
 types.
 
 On top of that, this series adds DevresLt<F: ForLt>, a thin wrapper
 around Devres<F::Of<'static>> that shortens the stored 'static lifetime
 back to the caller's borrow scope. DevresLt provides both closure-based
 access (access_with/try_access_with for ForLt types) and direct
 reference access (access/try_access for CovariantForLt types).
 
 Also implement ForLt and CovariantForLt for Bar, IoMem and
 ExclusiveIoMem, and update their into_devres() methods to return
 DevresLt. Provide convenience type aliases DevresBar, DevresIoMem and
 DevresExclusiveIoMem.
 
 This is a stable tag for other trees to merge.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCalVYCAAKCRBFlHeO1qrK
 Lv66AQCcu91WcBr1jpsMOptgN6rfg9WRqzn4Z69X2dKRz4XZKwD/Z3ihPBAuoDr8
 eqKjYG6cCV/qhEVgr0SctOO2xHVTVAE=
 =iqDJ
 -----END PGP SIGNATURE-----

Merge patch series "ForLt/CovariantForLt split, auxiliary closure API and DevresLt"

Danilo Krummrich <dakr@kernel.org> says:

The ForLt trait currently guarantees covariance, which allows safe
lifetime shortening via cast_ref(). However, some types (e.g. those
containing Mutex<&'bound T>) are invariant over their lifetime parameter
and cannot safely use cast_ref().

This series splits ForLt into two traits:

  - ForLt: base trait for all lifetime-parameterized types, providing
    only the Of<'a> GAT.

  - CovariantForLt: unsafe subtrait that guarantees covariance,
    providing a safe cast_ref() method.

For invariant types, a closure-based API (registration_data_with()) is
added to the auxiliary subsystem. The closure's HRTB prevents the caller
from choosing a concrete lifetime, which would be unsound for invariant
types.

On top of that, this series adds DevresLt<F: ForLt>, a thin wrapper
around Devres<F::Of<'static>> that shortens the stored 'static lifetime
back to the caller's borrow scope. DevresLt provides both closure-based
access (access_with/try_access_with for ForLt types) and direct
reference access (access/try_access for CovariantForLt types).

Also implement ForLt and CovariantForLt for Bar, IoMem and
ExclusiveIoMem, and update their into_devres() methods to return
DevresLt. Provide convenience type aliases DevresBar, DevresIoMem and
DevresExclusiveIoMem.

Link: https://patch.msgid.link/20260626183630.2585057-1-dakr@kernel.org
Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-07-13 23:34:30 +02:00
..
bindings rust: drm: add base GPUVM immediate mode abstraction 2026-05-05 12:52:49 +02:00
helpers mm.git review status for mm-hotfixes-stable..mm-nonmm-stable 2026-06-21 13:20:19 -07:00
kernel ForLt/CovariantForLt split, auxiliary closure API and DevresLt 2026-07-13 23:34:30 +02:00
macros rust: types: introduce ForLt base trait for CovariantForLt 2026-07-11 19:42:03 +02:00
pin-init rust: pin_init: internal: use loop {} to produce never value 2026-05-29 21:58:36 +01:00
proc-macro2 rust: proc-macro2: rebuild if the version text changes 2026-01-23 10:44:27 +01:00
quote rust: quote: add README.md 2025-11-24 17:15:43 +01:00
syn rust: syn: add README.md 2025-11-24 17:15:47 +01:00
uapi rust: declare cfi_encoding for lru_status 2026-04-07 10:00:25 +02:00
zerocopy rust: zerocopy: add README.md 2026-06-09 04:13:22 +02:00
zerocopy-derive rust: zerocopy-derive: add README.md 2026-06-09 04:13:23 +02:00
.gitignore rust: support running Rust documentation tests as KUnit ones 2023-07-19 09:32:53 -06:00
.kunitconfig rust: add kunitconfig 2025-03-19 23:22:21 +01:00
bindgen_parameters rust/bindgen_parameters: Mark s390 types as opaque to prevent repr conflicts 2026-06-10 16:25:13 +02:00
build_error.rs rust: add build_error crate 2022-12-04 01:59:16 +01:00
compiler_builtins.rs ARM: 9441/1: rust: Enable Rust support for ARMv7 2025-03-26 13:31:16 +00:00
exports.c kbuild: rust: provide an option to inline C helpers into Rust 2026-03-30 02:03:52 +02:00
ffi.rs rust: replace CStr with core::ffi::CStr 2025-10-22 07:47:27 +02:00
Makefile s390 updates for 7.2 merge window 2026-06-16 05:08:13 +05:30