Skip to content

Commit 27947b6

Browse files
authoredJul 20, 2020
Rollup merge of #74536 - Nicholas-Baron:master, r=joshtriplett
fix documentation surrounding the `in` and `for` keywords Addresses #74529 The `in` keyword incorrectly referenced the `Iterator` trait. This reference was changed to `IntoIterator` without changing the underlying link. Additionally, the `IntoIterator` trait was referenced towards the end of the documentation for `for`. An additional reference was added earlier and broadened the existing documentation from any iterator to anything that can be turned into an iterator.
2 parents e8fc993 + 09d5529 commit 27947b6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed
 

‎src/libstd/keyword_docs.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -474,8 +474,8 @@ mod fn_keyword {}
474474
/// * `for` is also used for [higher-ranked trait bounds] as in `for<'a> &'a T: PartialEq<i32>`.
475475
///
476476
/// for-in-loops, or to be more precise, iterator loops, are a simple syntactic sugar over a common
477-
/// practice within Rust, which is to loop over an iterator until that iterator returns `None` (or
478-
/// `break` is called).
477+
/// practice within Rust, which is to loop over anything that implements [`IntoIterator`] until the
478+
/// iterator returned by `.into_iter()` returns `None` (or the loop body uses `break`).
479479
///
480480
/// ```rust
481481
/// for i in 0..5 {
@@ -681,7 +681,7 @@ mod impl_keyword {}
681681
//
682682
/// Iterate over a series of values with [`for`].
683683
///
684-
/// The expression immediately following `in` must implement the [`Iterator`] trait.
684+
/// The expression immediately following `in` must implement the [`IntoIterator`] trait.
685685
///
686686
/// ## Literal Examples:
687687
///
@@ -690,7 +690,7 @@ mod impl_keyword {}
690690
///
691691
/// (Read more about [range patterns])
692692
///
693-
/// [`Iterator`]: ../book/ch13-04-performance.html
693+
/// [`IntoIterator`]: ../book/ch13-04-performance.html
694694
/// [range patterns]: ../reference/patterns.html?highlight=range#range-patterns
695695
/// [`for`]: keyword.for.html
696696
mod in_keyword {}

0 commit comments

Comments
 (0)
Please sign in to comment.