Skip to content

Commit

Permalink
Rollup merge of #74536 - Nicholas-Baron:master, r=joshtriplett
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Manishearth authored Jul 20, 2020
2 parents e8fc993 + 09d5529 commit 27947b6
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/libstd/keyword_docs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -474,8 +474,8 @@ mod fn_keyword {}
/// * `for` is also used for [higher-ranked trait bounds] as in `for<'a> &'a T: PartialEq<i32>`.
///
/// for-in-loops, or to be more precise, iterator loops, are a simple syntactic sugar over a common
/// practice within Rust, which is to loop over an iterator until that iterator returns `None` (or
/// `break` is called).
/// practice within Rust, which is to loop over anything that implements [`IntoIterator`] until the
/// iterator returned by `.into_iter()` returns `None` (or the loop body uses `break`).
///
/// ```rust
/// for i in 0..5 {
Expand Down Expand Up @@ -681,7 +681,7 @@ mod impl_keyword {}
//
/// Iterate over a series of values with [`for`].
///
/// The expression immediately following `in` must implement the [`Iterator`] trait.
/// The expression immediately following `in` must implement the [`IntoIterator`] trait.
///
/// ## Literal Examples:
///
Expand All @@ -690,7 +690,7 @@ mod impl_keyword {}
///
/// (Read more about [range patterns])
///
/// [`Iterator`]: ../book/ch13-04-performance.html
/// [`IntoIterator`]: ../book/ch13-04-performance.html
/// [range patterns]: ../reference/patterns.html?highlight=range#range-patterns
/// [`for`]: keyword.for.html
mod in_keyword {}
Expand Down

0 comments on commit 27947b6

Please sign in to comment.