Skip to content

Commit 9faede5

Browse files
committed
---
yaml --- r: 79862 b: refs/heads/master c: 49eb7bd h: refs/heads/master v: v3
1 parent 54ed520 commit 9faede5

File tree

2 files changed

+5
-18
lines changed

2 files changed

+5
-18
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
refs/heads/master: 67ed30cd5eab9af1976a994c50d146a3dbeccad4
2+
refs/heads/master: 49eb7bd2716f59e0cd47c427a4c60f49e8ce6e50
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: 54ae2800ffb30513f89ce13d27ac3c8d095d98ac
55
refs/heads/try: 71bebebc37fbb229877da88dde13c2f35913bd77

trunk/doc/rust.md

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2459,25 +2459,12 @@ do k(3) |j| {
24592459
### For expressions
24602460

24612461
~~~~~~~~{.ebnf .gram}
2462-
for_expr : "for" expr [ '|' ident_list '|' ] ? '{' block '}' ;
2462+
for_expr : "for" pat "in" expr '{' block '}' ;
24632463
~~~~~~~~
24642464

2465-
A _for expression_ is similar to a [`do` expression](#do-expressions),
2466-
in that it provides a special block-form of lambda expression,
2467-
suited to passing the `block` function to a higher-order function implementing a loop.
2468-
2469-
In contrast to a `do` expression, a `for` expression is designed to work
2470-
with methods such as `each` and `times`, that require the body block to
2471-
return a boolean. The `for` expression accommodates this by implicitly
2472-
returning `true` at the end of each block, unless a `break` expression
2473-
is evaluated.
2474-
2475-
In addition, [`break`](#break-expressions) and [`loop`](#loop-expressions) expressions
2476-
are rewritten inside `for` expressions in the same way that `return` expressions are,
2477-
with a combination of local flag variables,
2478-
and early boolean-valued returns from the `block` function,
2479-
such that the meaning of `break` and `loop` is preserved in a primitive loop
2480-
when rewritten as a `for` loop controlled by a higher order function.
2465+
A `for` expression is a syntactic construct for looping
2466+
over elements provided by an implementation of
2467+
`std::iterator::Iterator`.
24812468

24822469
An example of a for loop over the contents of a vector:
24832470

0 commit comments

Comments
 (0)