@@ -750,12 +750,11 @@ pub trait Itertools: Iterator {
750750 /// Use the method `.remainder()` to access leftover items in case
751751 /// the number of items yielded by the original iterator is not a multiple of `N`.
752752 ///
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.
755754 ///
756755 /// See also the method [`.next_array()`](Itertools::next_array).
757756 ///
758- /// ```
757+ /// ```rust
759758 /// use itertools::Itertools;
760759 /// let mut v = Vec::new();
761760 /// for [a, b] in (1..5).array_chunks() {
@@ -779,12 +778,13 @@ pub trait Itertools: Iterator {
779778 ///
780779 /// let it: ArrayChunks<Range<u32>, 3> = (1..7).array_chunks();
781780 /// itertools::assert_equal(it, vec![[1, 2, 3], [4, 5, 6]]);
781+ /// ```
782782 ///
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() );
788788 /// ```
789789 #[ cfg( feature = "use_alloc" ) ]
790790 fn array_chunks < const N : usize > ( self ) -> ArrayChunks < Self , N >
0 commit comments