Skip to content
Merged
Show file tree
Hide file tree
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
Add missing Debug derive to vec::IntoIter
  • Loading branch information
zeenix committed Aug 13, 2025
commit a290cec51482e672c28cb582a801eab26db0513e
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Removed generic from `history_buf::OldestOrdered`.
- Made `LenType` opt-in.
- Minor fixes to `pool::boxed` docs.
- Add missing `Debug` derive to `vec::IntoIter`.

### Fixed

Expand Down
25 changes: 25 additions & 0 deletions src/vec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,6 +1495,31 @@ where
}
}

impl<T, LenT: LenType, const N: usize> core::fmt::Debug for IntoIter<T, N, LenT>
where
T: core::fmt::Debug,
{
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
let s = if self.next < self.vec.len {
unsafe {
slice::from_raw_parts(
self.vec
.buffer
.buffer
.as_ptr()
.cast::<T>()
.add(self.next.into_usize()),
(self.vec.len - self.next).into_usize(),
)
}
} else {
&[]
};

write!(f, "{s:?}")
}
}

impl<T, LenT: LenType, const N: usize> Drop for IntoIter<T, N, LenT> {
fn drop(&mut self) {
unsafe {
Expand Down