SIGN IN SIGN UP
rust-lang / rust UNCLAIMED

Empowering everyone to build reliable and efficient software.

0 0 65 Rust

Rollup merge of #150580 - CieriA:patch-3, r=jhpratt

Document `panic!` in `Iterator::last` for #149707

This PR adds a section `# Panics` to the method `Iterator::last` equal to the section `# Panics` of the method `Iterator::count`, because now, after the changes made in Rust 1.92.0, both methods in `std::iter::Repeat` panics instead of doing an infinite loop.

`Iterator::count` already has documentation for this behavior ("This function might panic if the iterator has more than `usize::MAX` elements."), but `Iterator::last` does not. This PR adds documentation for this panic in the same way as `Iterator::count` does.

Issue: rust-lang/rust#149707
J
Jacob Pratt committed
9c5bdbd9607a7a8d333e82739a76853fa3006696
Committed by GitHub <noreply@github.com> on 1/2/2026, 4:27:56 AM