library: Document panic condition for Iterator::last
Added a `# Panics` section to `Iterator::last` to match `Iterator::count`, after the change made in Rust 1.92.0 where now `std::iter::Repeat` panics in these methods instead of doing an infinite `loop`. Cites https://github.com/rust-lang/rust/issues/149707
This commit is contained in:
parent
056908d7f4
commit
d68c980c22
1 changed files with 5 additions and 0 deletions
|
|
@ -236,6 +236,11 @@ pub trait Iterator {
|
|||
/// doing so, it keeps track of the current element. After [`None`] is
|
||||
/// returned, `last()` will then return the last element it saw.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This function might panic if the iterator has more than [`usize::MAX`]
|
||||
/// elements.
|
||||
///
|
||||
/// # Examples
|
||||
///
|
||||
/// ```
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue