From 64f96fa242cdbd4fdf41802d344db9f52ea75376 Mon Sep 17 00:00:00 2001 From: Anees Iqbal Date: Sat, 21 Nov 2026 15:47:32 -0800 Subject: [PATCH] Translator: the trip-top pass's work ticks convert the meter's error What: spirv::carry's tick helper returns the meter's refusal through ? (the meter's error type is the front end's), and the empty predecessor and loop lists are taken with unwrap_or_default rather than a full-range slice. Why: 2fbfafe0fe did not compile (job m3-max-64064 at the product build: mismatched types at the tick's return). Verified: the compile job on this commit. --- crates/metal2vulkan/src/spirv/carry.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/metal2vulkan/src/spirv/carry.rs b/crates/metal2vulkan/src/spirv/carry.rs index f3f6b2fc7..50d0b0983 100644 --- a/crates/metal2vulkan/src/spirv/carry.rs +++ b/crates/metal2vulkan/src/spirv/carry.rs @@ -154,7 +154,8 @@ fn hold(meter: &mut Meter, held: &mut usize, bytes: usize) -> Result<(), Error> } fn tick(meter: &mut Meter, units: usize) -> Result<(), Error> { - meter.tick(u32::try_from(units).unwrap_or(u32::MAX)) + meter.tick(u32::try_from(units).unwrap_or(u32::MAX))?; + Ok(()) } /// What one marked variable does in one block: its first access there is a read (else a whole @@ -273,7 +274,7 @@ fn select( } }); } - let preds_of = |i: usize| preds.get(i).map_or(&[][..], Vec::as_slice); + let preds_of = |i: usize| preds.get(i).map(Vec::as_slice).unwrap_or_default(); // The loops, by header in layout order: each one's first block and the loops each block is in. let mut firsts: Vec = Vec::new(); @@ -440,7 +441,11 @@ fn select( stack.push(p); } } - for &l in loops_of.get(s0 as usize).map_or(&[][..], Vec::as_slice) { + for &l in loops_of + .get(s0 as usize) + .map(Vec::as_slice) + .unwrap_or_default() + { let Some(&first) = firsts.get(l as usize) else { continue; };