Junjie Mao <junjie....@hotmail.com> writes:

> offset_of! was stabilized in Rust 1.77.0. Use an alternative implemenation
> that was found on the Rust forums, and whose author agreed to license as
> MIT for use in QEMU.
>
> The alternative allows only one level of field access, but apart from this
> can be used just by replacing core::mem::offset_of! with
> qemu_api::offset_of!.
>
> Using offset_of! prior Rust 1.77.0 requires the structure to have the
> derive(qemu_api_macros::Offsets) attribute.
>
> Base on Paolo's fix series [1].
>
> Make sure to remove subprojects/syn-2.0.66 if there is an existing
> build. An additional feature cfg is added to
> packagefiles/syn-2-rs/meson.build, which requires meson to re-checkout the
> subproject.
>
> TODO:
>
> 1. For each type of error detected in the proc macro:
>     a. Determine the proper span in the error reports.
>     b. Add tests.
>
> v1 -> v2:
>
> * Rebase to [1].
> * The proc macro now generates a call to the with_offsets! macro rule
>   instead of generating everything by itself.
> * Use quote_spanned! when reporting errors in the proc macro.
> * Add qemu-api-macro as a dependency of qemu-api for cargo expand.
>
> [1] 
> https://lore.kernel.org/qemu-devel/20241021163538.136941-1-pbonz...@redhat.com
>
> Co-authored-by: Paolo Bonzini <pbonz...@redhat.com>
> Signed-off-by: Paolo Bonzini <pbonz...@redhat.com>
> Signed-off-by: Junjie Mao <junjie....@hotmail.com>

Just noticed Paolo has a refreshed version in his v2 series.

Kindly ignore this patch.

--
Best Regards
Junjie Mao

Reply via email to