Use #[track_caller] to make panic in Iterator::array_chunks nicer

This commit is contained in:
Maybe Waffle 2022-08-01 18:34:30 +04:00
parent 4db628a801
commit 3102b39daa
2 changed files with 2 additions and 0 deletions

View File

@ -24,6 +24,7 @@ impl<I, const N: usize> ArrayChunks<I, N>
where
I: Iterator,
{
#[track_caller]
pub(in crate::iter) fn new(iter: I) -> Self {
assert!(N != 0, "chunk size must be non-zero");
Self { iter: iter.fuse(), remainder: None }

View File

@ -3350,6 +3350,7 @@ fn cycle(self) -> Cycle<Self>
/// assert_eq!(x + y + z, 4);
/// }
/// ```
#[track_caller]
#[unstable(feature = "iter_array_chunks", reason = "recently added", issue = "none")]
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
where