Re: [PATCH DNM 2/2] interconnect: Add a test Rust consumer driver
From: Benno Lossin
Date: Wed Jul 23 2025 - 09:24:41 EST
On Wed Jul 23, 2025 at 3:10 PM CEST, Daniel Almeida wrote:
> On 22 Jul 2025, at 18:14, Konrad Dybcio <konradybcio@xxxxxxxxxx> wrote:
>> +#[pin_data]
>> +struct IccTestConsumerDriver {
>> + #[pin]
>> + path: IccPath,
>> +}
>
> I don’t think this does anything useful without PhantomPinned, but Benno is
> the right person to chime in here.
It does do something useful, there just has to be one type marked with
`#[pin]` that is `!Unpin` (so for example `PhantomPinned`, `Opaque<T>`
etc.).
In this case however, `IccPath` is a newtype of `*mut bindings::icc_path`
which isn't `PhantomPinned`, so this doesn't ensure that the
`IccTestConsumerDriver` will stay pinned after initializing.
> More importantly though, why do you have #[pin] on IccPath?
Another question is: why is `IccPath` not a newtype of
`Opaque<bindings::icc_path>`? And then one can use `&IccPath`.
---
Cheers,
Benno