]> git.ipfire.org Git - thirdparty/qemu.git/commit
rust: macros: check that #[derive(Object)] requires #[repr(C)]
authorPaolo Bonzini <pbonzini@redhat.com>
Thu, 24 Oct 2024 09:57:02 +0000 (11:57 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Fri, 10 Jan 2025 22:34:43 +0000 (23:34 +0100)
commit20f0b8e98b4851bfd52bbb4edd4b602d08b9b817
tree48080f85c290b9a87a16044d8bd03afcffdf0728
parent7f65d4e58b67d6e5ee05c9381a50ef1eba3a5a1e
rust: macros: check that #[derive(Object)] requires #[repr(C)]

Convert derive_object to the same pattern of first making a
Result<proc_macro2::TokenStream, CompileError>, and then doing
.unwrap_or_else(Into::into) to support checking the validity of
the input.  Add is_c_repr to check that all QOM structs include
a #[repr(C)] attribute.

Reviewed-by: Zhao Liu <zhao1.liu@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rust/qemu-api-macros/src/lib.rs