diff --git a/rust/migration/src/vmstate.rs b/rust/migration/src/vmstate.rs index 42e5df8d81..5a237c409a 100644 --- a/rust/migration/src/vmstate.rs +++ b/rust/migration/src/vmstate.rs @@ -268,7 +268,7 @@ macro_rules! impl_vmstate_transparent { ($type:ty where $base:tt: VMState $($where:tt)*) => { unsafe impl<$base> $crate::vmstate::VMState for $type where $base: $crate::vmstate::VMState $($where)* { const BASE: $crate::vmstate::VMStateField = $crate::vmstate::VMStateField { - size: mem::size_of::<$type>(), + size: ::core::mem::size_of::<$type>(), ..<$base as $crate::vmstate::VMState>::BASE }; const VARRAY_FLAG: $crate::bindings::VMStateFlags = <$base as $crate::vmstate::VMState>::VARRAY_FLAG; @@ -282,6 +282,7 @@ impl_vmstate_transparent!(std::cell::Cell where T: VMState); impl_vmstate_transparent!(std::cell::UnsafeCell where T: VMState); impl_vmstate_transparent!(std::pin::Pin where T: VMState); impl_vmstate_transparent!(common::Opaque where T: VMState); +impl_vmstate_transparent!(std::mem::ManuallyDrop where T: VMState); #[macro_export] macro_rules! impl_vmstate_bitsized { diff --git a/rust/qom/src/qom.rs b/rust/qom/src/qom.rs index 5808051cd7..84455cea79 100644 --- a/rust/qom/src/qom.rs +++ b/rust/qom/src/qom.rs @@ -102,7 +102,7 @@ use std::{ }; use common::Opaque; -use migration::impl_vmstate_pointer; +use migration::{impl_vmstate_pointer, impl_vmstate_transparent}; use crate::bindings::{ self, object_class_dynamic_cast, object_dynamic_cast, object_get_class, object_get_typename, @@ -182,6 +182,7 @@ macro_rules! qom_isa { #[derive(Debug)] #[repr(transparent)] pub struct ParentField(std::mem::ManuallyDrop); +impl_vmstate_transparent!(ParentField where T: VMState + ObjectType); impl Deref for ParentField { type Target = T;