From: Paolo Bonzini Date: Mon, 13 Oct 2025 14:01:55 +0000 (+0200) Subject: rust: migration: hide more warnings from call_func_with_field! X-Git-Tag: v10.2.0-rc1~64^2~25 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=ceda1563d6d347647419f61508856e5236069e02;p=thirdparty%2Fqemu.git rust: migration: hide more warnings from call_func_with_field! 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 --- diff --git a/rust/migration/src/vmstate.rs b/rust/migration/src/vmstate.rs index e04b19b3c9..5f5708ad39 100644 --- a/rust/migration/src/vmstate.rs +++ b/rust/migration/src/vmstate.rs @@ -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) -> ::core::marker::PhantomData { ::core::marker::PhantomData } // Unreachable code is exempt from checks on uninitialized values. // Use that trick to infer the type of this PhantomData.