Skip to content

Commit ffc77c2

Browse files
authored
Rollup merge of #150658 - CieriA:patch-5, r=jhpratt
Clarify panic conditions in `Iterator::last` Follow-up PR to #150580. Now `Iterator::last`'s docs specify that it might panic only if the iterator is infinite, rather than if it has more than `usize::MAX` elements. # Motivation This is because `Iterator::last`, unlike `count`, also works on iterators with more than `usize::MAX` elements, but could panic on infinite iterators (as in `Repeat`), as discussed in #150580. r? `@jhpratt`
2 parents ff83629 + 52d65b8 commit ffc77c2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

library/core/src/iter/traits/iterator.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,8 +238,7 @@ pub trait Iterator {
238238
///
239239
/// # Panics
240240
///
241-
/// This function might panic if the iterator has more than [`usize::MAX`]
242-
/// elements.
241+
/// This function might panic if the iterator is infinite.
243242
///
244243
/// # Examples
245244
///

0 commit comments

Comments
 (0)