On Mon, Jun 09, 2025 at 05:44:23PM +0200, Paolo Bonzini wrote: > Date: Mon, 9 Jun 2025 17:44:23 +0200 > From: Paolo Bonzini <pbonz...@redhat.com> > Subject: [PATCH 5/5] rust: qom: change instance_init to take a ParentInit<> > X-Mailer: git-send-email 2.49.0 > > This removes undefined behavior associated to writing to uninitialized > fields, and makes it possible to remove "unsafe" from the instance_init > implementation. > > However, the init function itself is still unsafe, because it must promise > (as a sort as MaybeUninit::assume_init) that all fields have been > initialized. > > Signed-off-by: Paolo Bonzini <pbonz...@redhat.com> > --- > rust/hw/char/pl011/src/device.rs | 34 ++++++++++----------- > rust/hw/timer/hpet/src/device.rs | 16 ++++------ > rust/qemu-api/src/memory.rs | 12 ++++---- > rust/qemu-api/src/qdev.rs | 51 ++++++++++++++++++++------------ > rust/qemu-api/src/qom.rs | 9 ++++-- > 5 files changed, 65 insertions(+), 57 deletions(-)
Reviewed-by: Zhao Liu <zhao1....@intel.com>