On Thu, Jul 17, 2025 at 9:27 AM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> This needs a bit of preparation, but it simplifies the handwritten parsing
> code down to approximately 10 lines, and slightly improves the error
> messages too. All the scaffolding will be shared by future uses of
> procedural macros.
>
> Thanks to the author of the attrs crate, Aatif Syed, for accepting to lower
> his crate's minimum supported Rust version to 1.83.
>
> Paolo
>
> Paolo Bonzini (4):
> subprojects: update proc-macro2 and syn
> subprojects: add attrs crate
> rust: qemu-api-macros: support matching more than one error
> rust: qemu-api-macros: switch #[property] parsing to use combinators
>
> rust/Cargo.lock | 19 ++++-
> rust/meson.build | 2 +
> rust/qemu-api-macros/Cargo.toml | 1 +
> rust/qemu-api-macros/meson.build | 1 +
> rust/qemu-api-macros/src/lib.rs | 84 +++++++------------
> rust/qemu-api-macros/src/tests.rs | 14 ++--
> scripts/archive-source.sh | 2 +-
> scripts/make-release | 2 +-
> subprojects/.gitignore | 5 +-
> subprojects/attrs-0.2-rs.wrap | 7 ++
> .../packagefiles/attrs-0.2-rs/meson.build | 32 +++++++
> .../packagefiles/proc-macro2-1-rs/meson.build | 2 +-
> subprojects/packagefiles/syn-2-rs/meson.build | 2 +-
> subprojects/proc-macro2-1-rs.wrap | 8 +-
> subprojects/syn-2-rs.wrap | 8 +-
> 15 files changed, 111 insertions(+), 78 deletions(-)
> create mode 100644 subprojects/attrs-0.2-rs.wrap
> create mode 100644 subprojects/packagefiles/attrs-0.2-rs/meson.build
>
> --
> 2.50.1
>
Looks OK to me but are we sure it's necessary? This dependency is just
a syn::parse wrapper under the hood. Even serde's derive macros use
syn directly: https://github.com/serde-rs/serde/blob/babafa54d283fb087fa94f50a2cf82fa9e582a7c/serde_derive/src/internals/attr.rs#L276
I'm not against dependencies mind you, but this replaces just a few
lines of code.
--
Manos Pitsidianakis
Emulation and Virtualization Engineer at Linaro Ltd