Skip to content

Commit

Permalink
Rollup merge of rust-lang#24775 - mbrubeck:reference, r=steveklabnik
Browse files Browse the repository at this point in the history
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
  • Loading branch information
steveklabnik committed Apr 25, 2015
2 parents 5e38691 + 331821e commit c7279b4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/doc/reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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:

Expand All @@ -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);
}
```

Expand Down

0 comments on commit c7279b4

Please sign in to comment.