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.
This commit is contained in:
Anees Iqbal committed 2026-11-21 15:47:32 -08:00
1 parent 2fbfafe0fe
commit 64f96fa242
1 file changed
+8 -3
+8 -3
View File
@@ -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<usize> = 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;
};