diff --git a/naga/src/arena/mod.rs b/naga/src/arena/mod.rs index 8bd3fb84cf..014c5167c6 100644 --- a/naga/src/arena/mod.rs +++ b/naga/src/arena/mod.rs @@ -94,7 +94,7 @@ impl Arena { /// Returns an iterator over the items stored in this arena, returning both /// the item's handle and a reference to it. - pub fn iter(&self) -> impl DoubleEndedIterator, &T)> { + pub fn iter(&self) -> impl DoubleEndedIterator, &T)> + ExactSizeIterator { self.data .iter() .enumerate() diff --git a/naga/src/arena/unique_arena.rs b/naga/src/arena/unique_arena.rs index c64bb302eb..9f5e26df11 100644 --- a/naga/src/arena/unique_arena.rs +++ b/naga/src/arena/unique_arena.rs @@ -108,7 +108,7 @@ impl Iterator for UniqueArenaDrain<'_, T> { impl UniqueArena { /// Returns an iterator over the items stored in this arena, returning both /// the item's handle and a reference to it. - pub fn iter(&self) -> impl DoubleEndedIterator, &T)> { + pub fn iter(&self) -> impl DoubleEndedIterator, &T)> + ExactSizeIterator { self.set.iter().enumerate().map(|(i, v)| { let index = unsafe { Index::new_unchecked(i as u32) }; (Handle::new(index), v) diff --git a/naga/src/compact/mod.rs b/naga/src/compact/mod.rs index ef41a611cb..929888b7e5 100644 --- a/naga/src/compact/mod.rs +++ b/naga/src/compact/mod.rs @@ -303,8 +303,9 @@ impl<'module> ModuleTracer<'module> { // as used by the time we visit it is genuinely unused, and can be // ignored. let mut exprs = self.module.global_expressions.iter().rev().peekable(); - for ((ty_handle, ty), dep) in self.module.types.iter().rev().zip(max_dep.iter().rev()) { - while let Some((expr_handle, expr)) = exprs.next_if(|&(h, _)| Some(h) > *dep) { + + for ((ty_handle, ty), dep) in self.module.types.iter().zip(max_dep).rev() { + while let Some((expr_handle, expr)) = exprs.next_if(|&(h, _)| Some(h) > dep) { if self.global_expressions_used.contains(expr_handle) { self.as_const_expression().trace_expression(expr); }