Skip to content

Commit 97a7b03

Browse files
authored
Rollup merge of #67564 - Mark-Simulacrum:iter-adapter-panic, r=LukasKalbertodt
docs: Iterator adapters have unspecified results after a panic Fixes #58170. That issue also has rough consensus from 3 members of the library team for this being the behavior we would like to specify.
2 parents 2c46dd1 + 65e3660 commit 97a7b03

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/libcore/iter/mod.rs

+5
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,11 @@
216216
//! Common iterator adapters include [`map`], [`take`], and [`filter`].
217217
//! For more, see their documentation.
218218
//!
219+
//! If an iterator adapter panics, the iterator will be in an unspecified (but
220+
//! memory safe) state. This state is also not guaranteed to stay the same
221+
//! across versions of Rust, so you should avoid relying on the exact values
222+
//! returned by an iterator which panicked.
223+
//!
219224
//! [`map`]: trait.Iterator.html#method.map
220225
//! [`take`]: trait.Iterator.html#method.take
221226
//! [`filter`]: trait.Iterator.html#method.filter

0 commit comments

Comments
 (0)