Rollup merge of #24775 - mbrubeck:reference, r=steveklabnik

Update 7.2.20 (`for` expressions):

* `for` loops now use `IntoIterator` instead of just `Iterator`
* Simplify the example by removing unnecessary `Vec::iter` call.

...and a fix for a minor formatting error.

r? @steveklabnik
This commit is contained in:
Steve Klabnik 2015-04-24 22:54:27 -04:00
commit c7279b4214

View File

@ -2291,7 +2291,7 @@ The currently implemented features of the reference compiler are:
terms of encapsulation).
If a feature is promoted to a language feature, then all existing programs will
start to receive compilation warnings about #[feature] directives which enabled
start to receive compilation warnings about `#![feature]` directives which enabled
the new feature (because the directive is no longer necessary). However, if a
feature is decided to be removed from the language, errors will be issued (if
there isn't a parser error first). The directive in this case is no longer
@ -2897,7 +2897,7 @@ loops](#infinite-loops), [break expressions](#break-expressions), and
### For expressions
A `for` expression is a syntactic construct for looping over elements provided
by an implementation of `std::iter::Iterator`.
by an implementation of `std::iter::IntoIterator`.
An example of a for loop over the contents of an array:
@ -2910,8 +2910,8 @@ An example of a for loop over the contents of an array:
let v: &[Foo] = &[a, b, c];
for e in v.iter() {
bar(*e);
for e in v {
bar(e);
}
```