From 468a91feabe3feeb73f5196445eae68fe005b005 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sun, 1 Nov 2026 12:32:41 -0800 Subject: [PATCH] Size a copied constant's children with size_of_val clippy's manual_slice_size_calculation (rust 1.98) stopped the workspace's clippy at copy_bytes, the linked-module copy's ledger estimate: size_of::() * children().len() over the slice children() returns. The same bytes, as size_of_val of that slice. Verified: cargo clippy --workspace --all-targets --all-features -D warnings, plain and under --cfg m2v_gpu (own target), clean; rustdoc -D warnings for the workspace, clean. (Carried to development from steelbrain/reims-graphics-kext d232492977.) --- crates/metal2vulkan-air/src/canon/link.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/crates/metal2vulkan-air/src/canon/link.rs b/crates/metal2vulkan-air/src/canon/link.rs index 6685ab894..61e2107e3 100644 --- a/crates/metal2vulkan-air/src/canon/link.rs +++ b/crates/metal2vulkan-air/src/canon/link.rs @@ -1062,8 +1062,7 @@ fn copy_bytes(parts: &ModuleParts) -> usize { .fold(0usize, |n, b| n.saturating_add(b.footprint())); let consts = parts.consts.iter().fold(0usize, |n, (_, c)| { n.saturating_add( - std::mem::size_of::() - + std::mem::size_of::() * c.value.children().len(), + std::mem::size_of::() + std::mem::size_of_val(c.value.children()), ) }); let strings = (0..parts.symbols.len())