Skip to content

Commit 9941774

Browse files
committed
fix compilation in future rust versions
1 parent 19d0291 commit 9941774

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

src/lib.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ impl <T, const N: usize> IntoIterator for HeapArray<T, N> {
194194
type IntoIter = <[T; N] as IntoIterator>::IntoIter;
195195

196196
fn into_iter(self) -> Self::IntoIter {
197-
self.data.into_iter()
197+
// This moves the whole array from heap to the stack and is extremely inefficient.
198+
// After <https://github.com/rust-lang/rust/pull/134021> is merged, this could use
199+
// `<Box<[T; N]> as IntoIterator>::IntoIter`, which keeps the array in place.
200+
<[T; N]>::into_iter(*self.data)
198201
}
199202
}
200203

0 commit comments

Comments
 (0)