diff options
| author | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-08-01 18:34:30 +0400 |
|---|---|---|
| committer | Maybe Waffle <waffle.lapkin@gmail.com> | 2022-08-01 19:16:36 +0400 |
| commit | 3102b39daad9a9d3975ceb32d9cf62e76ececd24 (patch) | |
| tree | c3e9503ee4351d9c220ef3ea27789a535b82dd6b | |
| parent | 4db628a801d9efae4fe36d54b9e7deee61f341fb (diff) | |
| download | rust-3102b39daad9a9d3975ceb32d9cf62e76ececd24.tar.gz rust-3102b39daad9a9d3975ceb32d9cf62e76ececd24.zip | |
Use `#[track_caller]` to make panic in `Iterator::array_chunks` nicer
| -rw-r--r-- | library/core/src/iter/adapters/array_chunks.rs | 1 | ||||
| -rw-r--r-- | library/core/src/iter/traits/iterator.rs | 1 |
2 files changed, 2 insertions, 0 deletions
diff --git a/library/core/src/iter/adapters/array_chunks.rs b/library/core/src/iter/adapters/array_chunks.rs index c2de5efed1a..f8a52ecb618 100644 --- a/library/core/src/iter/adapters/array_chunks.rs +++ b/library/core/src/iter/adapters/array_chunks.rs @@ -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 } diff --git a/library/core/src/iter/traits/iterator.rs b/library/core/src/iter/traits/iterator.rs index d41cf78e000..95c7cf5758c 100644 --- a/library/core/src/iter/traits/iterator.rs +++ b/library/core/src/iter/traits/iterator.rs @@ -3350,6 +3350,7 @@ pub trait Iterator { /// 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 |
