]> git.ipfire.org Git - thirdparty/qemu.git/commitdiff
rust: migration: hide more warnings from call_func_with_field!
authorPaolo Bonzini <pbonzini@redhat.com>
Mon, 13 Oct 2025 14:01:55 +0000 (16:01 +0200)
committerPaolo Bonzini <pbonzini@redhat.com>
Mon, 13 Oct 2025 23:44:43 +0000 (01:44 +0200)
The call_func_with_field! macro uses dead code willingly to infer
the appropriate type.  This has started adding a new warning:

error: unused variable: `value__`
 79 |             break phantom__(&{ let value__: $typ; value__.$($field).+ })

So shut it up together with the existing unreachable_code warning.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
rust/migration/src/vmstate.rs

index e04b19b3c9f310b18f19779caadbc9e81d318f1e..5f5708ad39ebf2fbf1b8cd613c44a7f1e5cafa23 100644 (file)
@@ -72,6 +72,7 @@ macro_rules! call_func_with_field {
     ($func:expr, $typ:ty, $($field:tt).+) => {
         $func(loop {
             #![allow(unreachable_code)]
+            #![allow(unused_variables)]
             const fn phantom__<T>(_: &T) -> ::core::marker::PhantomData<T> { ::core::marker::PhantomData }
             // Unreachable code is exempt from checks on uninitialized values.
             // Use that trick to infer the type of this PhantomData.