diff --git a/Cargo.toml b/Cargo.toml index 53fa513ff..8ca91f0cb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -581,9 +581,8 @@ nonstandard_style = { level = "deny", priority = -2 } rust_2018_idioms = { level = "deny", priority = -2 } rust-2024-compatibility = { level = "warn", priority = -1 } -# TODO: Fix all of the below, https://github.com/microsoft/openvmm/issues/288 edition_2024_expr_fragment_specifier = "allow" -impl_trait_overcaptures = "allow" +# TODO: Fix all of the below, https://github.com/microsoft/openvmm/issues/288 deprecated-safe-2024 = "allow" unused_qualifications = "warn" diff --git a/openhcl/openhcl_boot/src/host_params/dt.rs b/openhcl/openhcl_boot/src/host_params/dt.rs index 6c7a05428..a32e6c98e 100644 --- a/openhcl/openhcl_boot/src/host_params/dt.rs +++ b/openhcl/openhcl_boot/src/host_params/dt.rs @@ -69,7 +69,7 @@ fn allocate_vtl2_ram( params: &ShimParams, partition_memory_map: &[MemoryEntry], ram_size: Option, -) -> OffStackRef<'static, impl AsRef<[MemoryEntry]>> { +) -> OffStackRef<'static, impl AsRef<[MemoryEntry]> + use<>> { // First, calculate how many numa nodes there are by looking at unique numa // nodes in the memory map. let mut numa_nodes = off_stack!(ArrayVec, ArrayVec::new_const()); @@ -262,7 +262,7 @@ fn allocate_vtl2_ram( fn parse_host_vtl2_ram( params: &ShimParams, memory: &[MemoryEntry], -) -> OffStackRef<'static, impl AsRef<[MemoryEntry]>> { +) -> OffStackRef<'static, impl AsRef<[MemoryEntry]> + use<>> { // If no VTL2 protectable ram was provided by the host, use the build time // value encoded in ShimParams. let mut vtl2_ram = off_stack!(ArrayVec, ArrayVec::new_const()); diff --git a/openhcl/openhcl_boot/src/host_params/mod.rs b/openhcl/openhcl_boot/src/host_params/mod.rs index 9c1bf141f..e35abf286 100644 --- a/openhcl/openhcl_boot/src/host_params/mod.rs +++ b/openhcl/openhcl_boot/src/host_params/mod.rs @@ -126,7 +126,7 @@ impl PartitionInfo { } /// Returns the parameter regions that are not being reclaimed. - pub fn vtl2_config_regions(&self) -> impl Iterator { + pub fn vtl2_config_regions(&self) -> impl Iterator + use<> { subtract_ranges( [self.vtl2_full_config_region], [self.vtl2_config_region_reclaim], diff --git a/openhcl/openhcl_boot/src/main.rs b/openhcl/openhcl_boot/src/main.rs index a1a8a306f..bcc632df2 100644 --- a/openhcl/openhcl_boot/src/main.rs +++ b/openhcl/openhcl_boot/src/main.rs @@ -314,7 +314,7 @@ enum ReservedMemoryType { fn reserved_memory_regions( partition_info: &PartitionInfo, sidecar: Option<&SidecarConfig<'_>>, -) -> OffStackRef<'static, impl AsRef<[(MemoryRange, ReservedMemoryType)]>> { +) -> OffStackRef<'static, impl AsRef<[(MemoryRange, ReservedMemoryType)]> + use<>> { let mut reserved = off_stack!(ArrayVec<(MemoryRange, ReservedMemoryType), MAX_RESERVED_MEM_RANGES>, ArrayVec::new_const()); reserved.clear(); reserved.extend( diff --git a/openvmm/openvmm_entry/src/ttrpc/mod.rs b/openvmm/openvmm_entry/src/ttrpc/mod.rs index bb276594c..1e2da9f4f 100644 --- a/openvmm/openvmm_entry/src/ttrpc/mod.rs +++ b/openvmm/openvmm_entry/src/ttrpc/mod.rs @@ -365,7 +365,7 @@ impl VmService { &self, ctx: mesh::CancelContext, request: inspect_proto::InspectRequest, - ) -> impl Future> { + ) -> impl Future> + use<> { let mut inspection = InspectionBuilder::new(&request.path) .depth(Some(request.depth as usize)) .inspect(inspect::adhoc(|req| { @@ -388,7 +388,7 @@ impl VmService { &self, ctx: mesh::CancelContext, request: inspect_proto::UpdateRequest, - ) -> impl Future> { + ) -> impl Future> + use<> { let update = inspect::update( &request.path, &request.value, @@ -604,13 +604,13 @@ impl VmService { Ok(()) } - fn pause_vm(&mut self, vm: &Vm) -> impl Future> { + fn pause_vm(&mut self, vm: &Vm) -> impl Future> + use<> { let (send, recv) = mesh::oneshot(); vm.worker_rpc.send(VmRpc::Pause(Rpc((), send))); async move { recv.await.map(drop).context("pause failed") } } - fn resume_vm(&mut self, vm: &Vm) -> impl Future> { + fn resume_vm(&mut self, vm: &Vm) -> impl Future> + use<> { let (send, recv) = mesh::oneshot(); vm.worker_rpc.send(VmRpc::Resume(Rpc((), send))); async move { recv.await.map(drop).context("resume failed") } @@ -620,7 +620,7 @@ impl VmService { &mut self, mut ctx: mesh::CancelContext, vm: Arc, - ) -> anyhow::Result>> { + ) -> anyhow::Result> + use<>> { let mut notify_recv = vm .notify_recv .lock() @@ -645,7 +645,7 @@ impl VmService { &mut self, vm: &Vm, request: vmservice::ModifyResourceRequest, - ) -> anyhow::Result>> { + ) -> anyhow::Result> + use<>> { use vmservice::modify_resource_request::Resource; match request.resource.context("missing resource")? { Resource::ScsiDisk(disk) => { diff --git a/support/fdt/src/parser.rs b/support/fdt/src/parser.rs index 492765477..c80abaaf7 100644 --- a/support/fdt/src/parser.rs +++ b/support/fdt/src/parser.rs @@ -671,7 +671,7 @@ impl<'a> Property<'a> { } /// Read data as an iterator of u64 values. - pub fn as_64_list(&self) -> Result + 'a, Error<'a>> { + pub fn as_64_list(&self) -> Result + use<'a>, Error<'a>> { Ok(U64b::slice_from(self.data) .ok_or(Error(ErrorKind::PropertyDataTypeBuffer { node_name: self.node_name, diff --git a/support/mesh/mesh_protobuf/src/protobuf.rs b/support/mesh/mesh_protobuf/src/protobuf.rs index 6b7f013d7..b65aecaba 100644 --- a/support/mesh/mesh_protobuf/src/protobuf.rs +++ b/support/mesh/mesh_protobuf/src/protobuf.rs @@ -666,7 +666,7 @@ impl<'a, 'b, R> MessageReader<'a, 'b, R> { } /// Returns an iterator to consume the resources for this message. - pub fn take_resources(&mut self) -> impl 'b + ExactSizeIterator> { + pub fn take_resources(&mut self) -> impl ExactSizeIterator> + use<'b, R> { let state = self.state; self.resources.clone().map(move |i| { state diff --git a/vm/devices/pci/pci_core/src/capabilities/msix.rs b/vm/devices/pci/pci_core/src/capabilities/msix.rs index 8d69f416c..34c395413 100644 --- a/vm/devices/pci/pci_core/src/capabilities/msix.rs +++ b/vm/devices/pci/pci_core/src/capabilities/msix.rs @@ -233,7 +233,7 @@ impl MsixEmulator { bar: u8, count: u16, register_msi: &mut dyn RegisterMsi, - ) -> (Self, impl PciCapability) { + ) -> (Self, impl PciCapability + use<>) { let state = MsixState { enabled: false, vectors: (0..count) diff --git a/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs b/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs index ffc79bce8..87c7829d0 100644 --- a/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs +++ b/vm/devices/storage/disk_nvme/nvme_driver/src/driver.rs @@ -444,7 +444,7 @@ impl NvmeDriver { drop(self); } - fn reset(&mut self) -> impl 'static + Send + std::future::Future { + fn reset(&mut self) -> impl Send + std::future::Future + use { let driver = self.driver.clone(); let mut task = std::mem::take(&mut self.task).unwrap(); async move { diff --git a/vm/devices/vmbus/vmbus_client_hcl/src/lib.rs b/vm/devices/vmbus/vmbus_client_hcl/src/lib.rs index 0c1cafbc6..6b35b8170 100644 --- a/vm/devices/vmbus/vmbus_client_hcl/src/lib.rs +++ b/vm/devices/vmbus/vmbus_client_hcl/src/lib.rs @@ -32,9 +32,9 @@ use zerocopy::AsBytes; /// Returns the synic client and message source for use with /// [`vmbus_client::VmbusClient`]. -pub fn new_synic_client_and_messsage_source( - driver: &(impl Driver + ?Sized), -) -> anyhow::Result<(impl SynicClient, impl VmbusMessageSource)> { +pub fn new_synic_client_and_messsage_source( + driver: &T, +) -> anyhow::Result<(impl SynicClient + use, impl VmbusMessageSource + use)> { // Open an HCL vmbus fd for issuing synic requests. let hcl_vmbus = Arc::new(HclVmbus::new().context("failed to open hcl_vmbus")?); let synic = HclSynic { diff --git a/vm/devices/vmbus/vmbus_server/src/hvsock.rs b/vm/devices/vmbus/vmbus_server/src/hvsock.rs index e41c3b800..4f810146a 100644 --- a/vm/devices/vmbus/vmbus_server/src/hvsock.rs +++ b/vm/devices/vmbus/vmbus_server/src/hvsock.rs @@ -114,7 +114,7 @@ impl HvsockRelay { &self, ctx: &mut CancelContext, service_id: Guid, - ) -> impl std::future::Future> + Send { + ) -> impl std::future::Future> + Send + use<> { let inner = self.inner.clone(); let host_send = self.host_send.clone(); let (send, recv) = mesh::oneshot(); diff --git a/vmm_core/state_unit/src/lib.rs b/vmm_core/state_unit/src/lib.rs index db0ad3fad..46f141148 100644 --- a/vmm_core/state_unit/src/lib.rs +++ b/vmm_core/state_unit/src/lib.rs @@ -887,12 +887,12 @@ impl ReadySet { /// future with a span, and wrapping its error with something more informative. /// /// `operation` and `name` are used in tracing and error construction. -fn state_change( +fn state_change) -> StateRequest>( name: Arc, unit: &Unit, - request: impl FnOnce(Rpc) -> StateRequest, + request: Req, input: Option, -) -> impl Future, UnitRecvError>> { +) -> impl Future, UnitRecvError>> + use { let (response_send, response_recv) = oneshot(); let send = unit.send.clone(); diff --git a/vmm_core/virt_whp/src/vtl2.rs b/vmm_core/virt_whp/src/vtl2.rs index 935100e10..dbb3d20e4 100644 --- a/vmm_core/virt_whp/src/vtl2.rs +++ b/vmm_core/virt_whp/src/vtl2.rs @@ -190,7 +190,7 @@ pub(crate) struct Vtl2Emulation { mod inspect_helpers { use super::*; - pub(super) fn vsm_config_raw(raw: &AtomicU64) -> impl Inspect { + pub(super) fn vsm_config_raw(raw: &AtomicU64) -> impl Inspect + use<> { let config = HvRegisterVsmPartitionConfig::from(raw.load(Ordering::Relaxed)); inspect::AsDebug(config) }