Use #[track_caller]
to make panic in Iterator::array_chunks
nicer
This commit is contained in:
parent
4db628a801
commit
3102b39daa
2 changed files with 2 additions and 0 deletions
|
@ -24,6 +24,7 @@ impl<I, const N: usize> ArrayChunks<I, N>
|
||||||
where
|
where
|
||||||
I: Iterator,
|
I: Iterator,
|
||||||
{
|
{
|
||||||
|
#[track_caller]
|
||||||
pub(in crate::iter) fn new(iter: I) -> Self {
|
pub(in crate::iter) fn new(iter: I) -> Self {
|
||||||
assert!(N != 0, "chunk size must be non-zero");
|
assert!(N != 0, "chunk size must be non-zero");
|
||||||
Self { iter: iter.fuse(), remainder: None }
|
Self { iter: iter.fuse(), remainder: None }
|
||||||
|
|
|
@ -3350,6 +3350,7 @@ pub trait Iterator {
|
||||||
/// assert_eq!(x + y + z, 4);
|
/// assert_eq!(x + y + z, 4);
|
||||||
/// }
|
/// }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[track_caller]
|
||||||
#[unstable(feature = "iter_array_chunks", reason = "recently added", issue = "none")]
|
#[unstable(feature = "iter_array_chunks", reason = "recently added", issue = "none")]
|
||||||
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
|
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>
|
||||||
where
|
where
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue