Re: [PATCH v3 03/18] migration: make .post_save() a void function
Zhao Liu <[email protected]> Mon, 9 Mar 2026 22:41:44 +0800
| Newsgroups | org.nongnu.qemu-rust,org.nongnu.qemu-arm,org.nongnu.qemu-devel |
|---|---|
| Message-ID | <[email protected]> |
> +CC Paolo, Zhao
>
> This change breaks the rust build:
> https://gitlab.com/farosas/qemu/-/jobs/13393119755
>
> error[E0308]: mismatched types
> --> ../rust/migration/src/vmstate.rs:605:18
> |
> 605 | Some(vmstate_no_version_cb::<T, F>)
> | ---- ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected fn pointer, found fn item
> | |
> | arguments to this enum variant are incorrect
> |
> = note: expected fn pointer `unsafe extern "C" fn(_) -> ()`
> found fn item `unsafe extern "C" fn(_) -> i32 {vmstate_no_version_cb::<T, F, impl Into<Errno>>}`
>
>
> Is something like the following diff the right fix? It'd be nice to get
> an ack so this series doesn't miss the freeze. (CI run:
> https://gitlab.com/farosas/qemu/-/pipelines/2369688593)
>
> -- >8 --
> From 90a7b53d2b0d53692df1ef2cfe7607b13e4961d8 Mon Sep 17 00:00:00 2001
> From: Fabiano Rosas <[email protected]>
> Date: Fri, 6 Mar 2026 18:53:14 -0300
> Subject: [PATCH] fixup! migration: make .post_save() a void function
>
> Signed-off-by: Fabiano Rosas <[email protected]>
> ---
> rust/migration/src/migratable.rs | 3 +--
> rust/migration/src/vmstate.rs | 12 +++++++-----
> 2 files changed, 8 insertions(+), 7 deletions(-)
>
> diff --git a/rust/migration/src/migratable.rs b/rust/migration/src/migratable.rs
> index 7748aac2f2..7088c1b156 100644
> --- a/rust/migration/src/migratable.rs
> +++ b/rust/migration/src/migratable.rs
> @@ -406,10 +406,9 @@ fn pre_save(&self) -> Result<(), InvalidError> {
> Ok(())
> }
>
> - fn post_save(&self) -> Result<(), InvalidError> {
> + fn post_save(&self) {
> let state = unsafe { Box::from_raw(self.migration_state.replace(ptr::null_mut())) };
> drop(state);
> - Ok(())
> }
What about this?
fn post_save(&self) {
let _ = unsafe { Box::from_raw(self.migration_state.replace(ptr::null_mut())) };
}
Others LGTM,
Reviewed-by: Zhao Liu <[email protected]>