about summary refs log tree commit diff
diff options
context:
space:
mode:
authorManish Goregaokar <manishsmail@gmail.com>2020-07-19 19:12:45 -0700
committerGitHub <noreply@github.com>2020-07-19 19:12:45 -0700
commit27947b69f9d879de45716312e4a7bd486d8d8f93 (patch)
tree9827865878e252122d172de6af05de74524c54e8
parente8fc9934097e67c3f3fe11874ad2a89694a80bf2 (diff)
parent09d55292ed1eca97b997f22656eb7e696e9c1bf1 (diff)
downloadrust-27947b69f9d879de45716312e4a7bd486d8d8f93.tar.gz
rust-27947b69f9d879de45716312e4a7bd486d8d8f93.zip
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.
-rw-r--r--src/libstd/keyword_docs.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/libstd/keyword_docs.rs b/src/libstd/keyword_docs.rs
index e17771f57ec..a62987891b9 100644
--- a/src/libstd/keyword_docs.rs
+++ b/src/libstd/keyword_docs.rs
@@ -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 {
@@ -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:
 ///
@@ -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 {}