Il lun 4 ago 2025, 10:56 Martin Kletzander <mklet...@redhat.com> ha scritto:

> *BUT* of course I had to rebase the patches on top of current rust-next
> on Friday and there were some of your commits from Thursday which I now
> see actually fix all what I tried fixing before as well.  I tried
> finding the previous commit on which I saw all the issues and after some
> rebuilding I could not.  So it is now not even broken on rust-next.
>
> This way I completely wasted your time, but at least learned something
> that's happening in the code.  Sorry for that.
>

Uh no you didn't. It was broken.

Paolo

Martin
>
> >Paolo
> >
> > rust/qemu-api/src/vmstate.rs         | 11 +++++++++++
> >>  rust/qemu-api/tests/vmstate_tests.rs |  1 +
> >>  2 files changed, 12 insertions(+)
> >>
> >> diff --git a/rust/qemu-api/src/vmstate.rs b/rust/qemu-api/src/
> vmstate.rs
> >> index b5c6b764fbba..716e52afe740 100644
> >> --- a/rust/qemu-api/src/vmstate.rs
> >> +++ b/rust/qemu-api/src/vmstate.rs
> >> @@ -449,6 +449,17 @@ macro_rules! vmstate_validate {
> >>  /// description of the struct.
> >>  #[macro_export]
> >>  macro_rules! impl_vmstate_struct {
> >> +    ($type:ty, $(&)?$vmsd:ident) => {
> >> +        unsafe impl $crate::vmstate::VMState for $type {
> >> +            const BASE: $crate::bindings::VMStateField =
> >> +                $crate::bindings::VMStateField {
> >> +                    vmsd: $vmsd.as_ref(),
> >> +                    size: ::core::mem::size_of::<$type>(),
> >> +                    flags: $crate::bindings::VMStateFlags::VMS_STRUCT,
> >> +                    ..$crate::zeroable::Zeroable::ZERO
> >> +                };
> >> +        }
> >> +    };
> >>      ($type:ty, $vmsd:expr) => {
> >>          unsafe impl $crate::vmstate::VMState for $type {
> >>              const BASE: $crate::bindings::VMStateField = {
> >> diff --git a/rust/qemu-api/tests/vmstate_tests.rs
> b/rust/qemu-api/tests/
> >> vmstate_tests.rs
> >> index 2c0670ba0eed..7d3180e6c2ea 100644
> >> --- a/rust/qemu-api/tests/vmstate_tests.rs
> >> +++ b/rust/qemu-api/tests/vmstate_tests.rs
> >> @@ -320,6 +320,7 @@ fn test_vmstate_struct_varray_uint8_wrapper() {
> >>          b"arr_a_wrap\0"
> >>      );
> >>      assert_eq!(foo_fields[5].num_offset, 228);
> >> +    assert_eq!(foo_fields[5].vmsd, VMSTATE_FOOA.as_ref());
> >>      assert!(unsafe { foo_fields[5].field_exists.unwrap()(foo_b_p, 0)
> });
> >>
> >>      // The last VMStateField in VMSTATE_FOOB.
> >> --
> >> 2.50.1
> >>
> >>
>

Reply via email to