Re: [PATCH v3 08/15] rust: pin-init: add `?Sized` bounds to traits in `#[pin_data]` macro

From: Gary Guo

Date: Wed Jan 14 2026 - 13:47:32 EST


On Wed Jan 14, 2026 at 6:18 PM GMT, Benno Lossin wrote:
> The `#[pin_data]` macro uses some auxiliary traits to ensure that a user
> does not implement `Drop` for the annotated struct, as that is unsound
> and can lead to UB. However, if the struct that is annotated is
> `!Sized`, the current bounds do not work, because `Sized` is an implicit
> bound for generics.
>
> This is *not* a soundness hole of pin-init, as it currently is
> impossible to construct an unsized struct using pin-init.
>
> Tested-by: Andreas Hindborg <a.hindborg@xxxxxxxxxx>
> Signed-off-by: Benno Lossin <lossin@xxxxxxxxxx>

Reviewed-by: Gary Guo <gary@xxxxxxxxxxx>

> ---
> Changes in v3: none
> Changes in v2: none
> ---
> rust/pin-init/internal/src/pin_data.rs | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)