Re: [PATCH 3/4] rust: macros: replace Self with the concrete type in #[pin_data]

From: Alice Ryhl
Date: Wed May 17 2023 - 16:46:15 EST


On 4/24/23 10:11, Benno Lossin wrote:
When using `#[pin_data]` on a struct that used `Self` in the field
types, a type error would be emitted when trying to use `pin_init!`.
Since an internal type would be referenced by `Self` instead of the
defined struct.
This patch fixes this issue by replacing all occurrences of `Self` in
the `#[pin_data]` macro with the concrete type circumventing the issue.
Since rust allows type definitions inside of blocks, which are
expressions, the macro also checks for these and emits a compile error
when it finds `trait`, `enum`, `union`, `struct` or `impl`. These
keywords allow creating new `Self` contexts, which conflicts with the
current implementation of replacing every `Self` ident. If these were
allowed, some `Self` idents would be replaced incorrectly.

Signed-off-by: Benno Lossin <benno.lossin@xxxxxxxxx>
Reported-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>

It seems like you're missing a newline in the commit message?

Reviewed-by: Alice Ryhl <aliceryhl@xxxxxxxxxx>