Re: [PATCH v6 00/15] Rust pin-init API for pinned initialization of structs

From: Benno Lossin
Date: Wed Apr 05 2023 - 17:07:10 EST


On 05.04.23 23:02, Boqun Feng wrote:
> On Wed, Apr 05, 2023 at 07:35:30PM +0000, Benno Lossin wrote:
>> Changelog:
>> v5 -> v6:
>> - Change `pinned_drop` macro to allow `mut self` in the signature.
>> - Change statement fragment to tt fragemnt in `pinned_drop` to prevent
>> parsing errors.
>> - Move evaluation of the value in `stack_pin_init!`/`stack_try_pin_init!`
>> to the beginning.
>
> Could you elaborate why? To make sure the $val evaluation happens
> unconditionally?

This is done to allow `stack_pin_init!(let value = value);` i.e. naming
the variable the same as the expression that is evaluated.

--
Cheers,
Benno

>> - Move setting uninitialized flag in front of dropping the value in
>> `StackInit::init`.
>> - Remove `Unpin` requirement on `zeroed()`.
>> - Add note about `Pointee` to the `Zeroable` impl on raw pointers.
>>
>
> Regards,
> Boqun