diff --git a/src/lib.rs b/src/lib.rs index 8fd71ac..969d4b7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -194,7 +194,10 @@ impl IntoIterator for HeapArray { type IntoIter = <[T; N] as IntoIterator>::IntoIter; fn into_iter(self) -> Self::IntoIter { - self.data.into_iter() + // This moves the whole array from heap to the stack and is extremely inefficient. + // After is merged, this could use + // ` as IntoIterator>::IntoIter`, which keeps the array in place. + <[T; N]>::into_iter(*self.data) } }