Re: [PATCH v2 03/25] rust: device: generalize drvdata methods over ForLt

From: Danilo Krummrich

Date: Mon May 11 2026 - 15:40:41 EST


On Thu May 7, 2026 at 2:50 PM CEST, Alice Ryhl wrote:
> On Wed, May 06, 2026 at 11:50:39PM +0200, Danilo Krummrich wrote:
>> - /// The type of the driver's device private data.
>> - type DriverData;
>> + /// The [`ForLt`](trait@ForLt) encoding of the driver's device private data type.
>> + type DriverData: ForLt;
>
> Associated types support ForLt natively.

Correct, and as it stands DriverData is only directly used for
Device::drvdata_obtain(), which doesn't necessarily need the covariance
guarantee the ForLt bound provides.

However, I chose to use ForLt regardless as it prevents future users of
DriverData from running into the covariance trap, plus it keeps the code more
streamlined in the driver-core and in buses.