Skip to content

Commit c7279b4

Browse files
committed
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
2 parents 5e38691 + 331821e commit c7279b4

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/doc/reference.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -2291,7 +2291,7 @@ The currently implemented features of the reference compiler are:
22912291
terms of encapsulation).
22922292

22932293
If a feature is promoted to a language feature, then all existing programs will
2294-
start to receive compilation warnings about #[feature] directives which enabled
2294+
start to receive compilation warnings about `#![feature]` directives which enabled
22952295
the new feature (because the directive is no longer necessary). However, if a
22962296
feature is decided to be removed from the language, errors will be issued (if
22972297
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
28972897
### For expressions
28982898

28992899
A `for` expression is a syntactic construct for looping over elements provided
2900-
by an implementation of `std::iter::Iterator`.
2900+
by an implementation of `std::iter::IntoIterator`.
29012901

29022902
An example of a for loop over the contents of an array:
29032903

@@ -2910,8 +2910,8 @@ An example of a for loop over the contents of an array:
29102910
29112911
let v: &[Foo] = &[a, b, c];
29122912
2913-
for e in v.iter() {
2914-
bar(*e);
2913+
for e in v {
2914+
bar(e);
29152915
}
29162916
```
29172917

0 commit comments

Comments
 (0)