[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 04/10] rust: macros: check that #[derive(Object)] requires #[repr
From: |
Paolo Bonzini |
Subject: |
[PATCH 04/10] rust: macros: check that #[derive(Object)] requires #[repr(C)] |
Date: |
Thu, 19 Dec 2024 13:12:10 +0100 |
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
- [PATCH 00/10] Next round of qemu_api patches, Paolo Bonzini, 2024/12/19
- [PATCH 07/10] rust: pl011: only leave embedded object initialization in instance_init, Paolo Bonzini, 2024/12/19
- [PATCH 01/10] rust: qom: add ParentField, Paolo Bonzini, 2024/12/19
- [PATCH 03/10] rust: macros: check that the first field of a #[derive(Object)] struct is a ParentField, Paolo Bonzini, 2024/12/19
- [PATCH 06/10] rust: qom: move device_id to PL011 class side, Paolo Bonzini, 2024/12/19
- [PATCH 04/10] rust: macros: check that #[derive(Object)] requires #[repr(C)],
Paolo Bonzini <=
- [PATCH 09/10] rust: qemu-api-macros: extend error reporting facility to parse errors, Paolo Bonzini, 2024/12/19
- [PATCH 05/10] rust: qom: automatically use Drop trait to implement instance_finalize, Paolo Bonzini, 2024/12/19
- [PATCH 02/10] rust: add a utility module for compile-time type checks, Paolo Bonzini, 2024/12/19
- [PATCH 10/10] rust: qemu-api-macros: add automatic TryFrom/TryInto derivation, Paolo Bonzini, 2024/12/19
- [PATCH 08/10] rust: qom: make INSTANCE_POST_INIT take a shared reference, Paolo Bonzini, 2024/12/19