[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 1/9] rust/vmstate: Support field_exists check in vmstate_stru
From: |
Paolo Bonzini |
Subject: |
Re: [PATCH 1/9] rust/vmstate: Support field_exists check in vmstate_struct macro |
Date: |
Wed, 16 Apr 2025 16:54:59 +0200 |
On Mon, Apr 14, 2025 at 4:29 PM Zhao Liu <zhao1.liu@intel.com> wrote:
>
> Unfortunately, at present it's not possible to have a const
> "with_exist_check" method to append test_fn after vmstate_struct (due
> to error on "constant functions cannot evaluate destructors" for `F`).
Nothing that std::mem::forget() can't fix. ;) We know that the
destructor is a no-op because FnCall is only implemented on zero-sized
functions.
Another problem with such a method, however, is that you need
VMStateField<T> for it to be type-safe. Implementing it on
bindings::VMStateField gives no guarantee that the type of the
argument to the function is the correct one. So this patch is okay
too, but perhaps add a comment (not necessarily a doc comment)
mentioning that VMStateField<T> is planned in order to remove the
extra argument?
Thanks,
Paolo
[PATCH 4/9] rust/vmstate_test: Fix typo in test_vmstate_macro_array_of_pointer_wrapped(), Zhao Liu, 2025/04/14
[PATCH 6/9] rust/hpet: convert num_timers to u8 type, Zhao Liu, 2025/04/14
[PATCH 3/9] rust/vmstate_test: Test varray with num field wrapped in BqlCell, Zhao Liu, 2025/04/14
[PATCH 5/9] rust/timer: Define NANOSECONDS_PER_SECOND binding as u64, Zhao Liu, 2025/04/14
[PATCH 8/9] rust/hpet: Support migration, Zhao Liu, 2025/04/14