@@ -106,10 +106,12 @@ pub trait Iterator {
106
106
107
107
/// Counts the number of elements in this iterator.
108
108
///
109
- /// # Undefined overflow
109
+ /// # Overflow Behavior
110
110
///
111
111
/// The method does no guarding against overflows, so counting elements of
112
- /// an iterator with more than `usize::MAX` elements is undefined.
112
+ /// an iterator with more than `usize::MAX` elements either produces the
113
+ /// wrong result or panics. If debug assertions are enabled, a panic is
114
+ /// guaranteed.
113
115
///
114
116
/// # Panics
115
117
///
@@ -291,10 +293,11 @@ pub trait Iterator {
291
293
/// different sized integer, the `zip` function provides similar
292
294
/// functionality.
293
295
///
294
- /// # Undefined overflow
296
+ /// # Overflow Behavior
295
297
///
296
298
/// The method does no guarding against overflows, so enumerating more than
297
- /// `usize::MAX` elements is undefined.
299
+ /// `usize::MAX` elements either produces the wrong result or panics. If
300
+ /// debug assertions are enabled, a panic is guaranteed.
298
301
///
299
302
/// # Panics
300
303
///
@@ -695,11 +698,12 @@ pub trait Iterator {
695
698
///
696
699
/// Does not consume the iterator past the first found element.
697
700
///
698
- /// # Undefined overflow
701
+ /// # Overflow Behavior
699
702
///
700
- /// The method does no guarding against overflows, so when there are more
701
- /// than `usize::MAX` non-matching elements, the overflow behaviour is
702
- /// undefined.
703
+ /// The method does no guarding against overflows, so if there are more
704
+ /// than `usize::MAX` non-matching elements, it either produces the wrong
705
+ /// result or panics. If debug assertions are enabled, a panic is
706
+ /// guaranteed.
703
707
///
704
708
/// # Panics
705
709
///
@@ -1801,10 +1805,11 @@ pub struct Enumerate<I> {
1801
1805
impl < I > Iterator for Enumerate < I > where I : Iterator {
1802
1806
type Item = ( usize , <I as Iterator >:: Item ) ;
1803
1807
1804
- /// # Undefined overflow
1808
+ /// # Overflow Behavior
1805
1809
///
1806
1810
/// The method does no guarding against overflows, so enumerating more than
1807
- /// `usize::MAX` elements is undefined.
1811
+ /// `usize::MAX` elements either produces the wrong result or panics. If
1812
+ /// debug assertions are enabled, a panic is guaranteed.
1808
1813
///
1809
1814
/// # Panics
1810
1815
///
0 commit comments