@@ -750,12 +750,11 @@ pub trait Itertools: Iterator {
750
750
/// Use the method `.remainder()` to access leftover items in case
751
751
/// the number of items yielded by the original iterator is not a multiple of `N`.
752
752
///
753
- /// If `N` is 0, the resulting iterator will be equivalent to `repeat([])`, i.e.
754
- /// `next()` will always return `Some([])`.
753
+ /// `N == 0` is a compile-time (but post-monomorphization) error.
755
754
///
756
755
/// See also the method [`.next_array()`](Itertools::next_array).
757
756
///
758
- /// ```
757
+ /// ```rust
759
758
/// use itertools::Itertools;
760
759
/// let mut v = Vec::new();
761
760
/// for [a, b] in (1..5).array_chunks() {
@@ -779,12 +778,13 @@ pub trait Itertools: Iterator {
779
778
///
780
779
/// let it: ArrayChunks<Range<u32>, 3> = (1..7).array_chunks();
781
780
/// itertools::assert_equal(it, vec![[1, 2, 3], [4, 5, 6]]);
781
+ /// ```
782
782
///
783
- /// let mut it = (1..3).array_chunks::<0>();
784
- /// assert_eq!(it.next(), Some([])) ;
785
- /// assert_eq!(it.next(), Some([]));
786
- /// // and so on for any further calls to `it.next()`
787
- /// itertools::assert_equal(it.remainder( ), 1..3 );
783
+ /// ```compile_fail
784
+ /// use itertools::Itertools ;
785
+ ///
786
+ /// let mut it = (1..5).array_chunks::<0>();
787
+ /// assert_eq!(Some([] ), it.next() );
788
788
/// ```
789
789
#[ cfg( feature = "use_alloc" ) ]
790
790
fn array_chunks < const N : usize > ( self ) -> ArrayChunks < Self , N >
0 commit comments