Re: [PATCH v2 03/11] rust: macros: convert `#[vtable]` macro to use `syn`
From: Gary Guo
Date: Sun Jan 11 2026 - 16:25:19 EST
On Sun Jan 11, 2026 at 5:03 PM GMT, Benno Lossin wrote:
> On Wed Jan 7, 2026 at 5:15 PM CET, Gary Guo wrote:
>> From: Gary Guo <gary@xxxxxxxxxxx>
>>
>> `#[vtable]` is converted to use syn. This is more robust than the
>> previous heuristic-based searching of defined methods and functions.
>>
>> When doing so, the trait and impl are split into two code paths as the
>> types are distinct when parsed by `syn`.
>>
>> Signed-off-by: Gary Guo <gary@xxxxxxxxxxx>
>
> Reviewed-by: Benno Lossin <lossin@xxxxxxxxxx>
>
>> ---
>> rust/macros/lib.rs | 9 ++-
>> rust/macros/vtable.rs | 163 ++++++++++++++++++++++--------------------
>> 2 files changed, 93 insertions(+), 79 deletions(-)
>
>> + // Skip if it's declared already -- this can happen if `#[cfg]` is used to selectively
>> + // define functions.
>> + // FIXME: `#[cfg]` should be copied and propagated to the generated consts.
>
> Do you mind creating an issue (probably difficulty medium) after this is
> merged?
I've already had a patch for this in my working branch. Following Tamir's
suggestion on how to change this patch it was trivially enough just add to the
series.
It'll be included in v3.
Best,
Gary