[PATCH 04/10] rust: macros: check that #[derive(Object)] requires #[repr(C)]

Paolo Bonzini posted 10 patches 4 days, 11 hours ago
There is a newer version of this series
[PATCH 04/10] rust: macros: check that #[derive(Object)] requires #[repr(C)]
Posted by Paolo Bonzini 4 days, 11 hours ago
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 rust/qemu-api-macros/src/lib.rs | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/rust/qemu-api-macros/src/lib.rs b/rust/qemu-api-macros/src/lib.rs
index 778b698be45..0f04cca3841 100644
--- a/rust/qemu-api-macros/src/lib.rs
+++ b/rust/qemu-api-macros/src/lib.rs
@@ -54,6 +54,8 @@ fn is_c_repr(input: &DeriveInput, msg: &str) -> Result<(), CompileError> {
 }
 
 fn derive_object_or_error(input: DeriveInput) -> Result<proc_macro2::TokenStream, CompileError> {
+    is_c_repr(&input, "#[derive(Object)]")?;
+
     let name = &input.ident;
     let parent = &get_fields(&input, "#[derive(Object)]")?[0].ident;
 
-- 
2.47.1