Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,10 @@ impl <T, const N: usize> IntoIterator for HeapArray<T, N> {
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 <https://github.com/rust-lang/rust/pull/134021> is merged, this could use
// `<Box<[T; N]> as IntoIterator>::IntoIter`, which keeps the array in place.
<[T; N]>::into_iter(*self.data)
}
}

Expand Down
Loading