|
4 | 4 | > _BlockExpression_ :\
|
5 | 5 | > `{`\
|
6 | 6 | > [_InnerAttribute_]<sup>\*</sup>\
|
7 |
| -> _Statements_<sup>\*</sup>\ |
| 7 | +> [_Statement_]<sup>\*</sup>\ |
8 | 8 | > [_Expression_]<sup>?</sup>\
|
9 | 9 | > `}`
|
10 |
| -> |
11 |
| -> _Statements_ :\ |
12 |
| -> ( `;`\ |
13 |
| -> | [_ItemDeclaration_]\ |
14 |
| -> | [_LetStatement_] ;\ |
15 |
| -> | [_NonControlFlowExpressionStatement_][expression statement] ;\ |
16 |
| -> | [_FlowControlExpressionStatement_][expression statement] ;<sup>?</sup>\ |
17 |
| -> )<sup>\*</sup> |
18 |
| -
|
19 |
| -A *block expression*, or *block*, is a control flow expression and anonymouse |
| 10 | +
|
| 11 | +A *block expression*, or *block*, is a control flow expression and anonymous |
20 | 12 | namespace scope for items and variable declarations. As a control flow
|
21 | 13 | expression, a block sequentially executes its component non-item declaration
|
22 | 14 | statements and then its final optional expression. As an anonymous namespace
|
@@ -60,7 +52,7 @@ assert_eq!(5, five);
|
60 | 52 | > expression of an expression statement, the expected type is `()` unless it
|
61 | 53 | > is followed immediately by a semicolon.
|
62 | 54 |
|
63 |
| -Blocks are always [value expressions] and evaluate the last expression in |
| 55 | +Blocks are always [value expressions] and evaluate the last expression in |
64 | 56 | value expression context. This can be used to force moving a value if really
|
65 | 57 | needed. For example, the following example fails on the call to `consume_self`
|
66 | 58 | because the struct was moved out of `s` in the block expression.
|
@@ -126,9 +118,7 @@ fn is_unix_platform() -> bool {
|
126 | 118 | ```
|
127 | 119 |
|
128 | 120 | [_InnerAttribute_]: attributes.html
|
129 |
| -[_ItemDeclaration_]: items.html |
130 |
| -[_LetStatement_]: statements.html#let-statements |
131 |
| -[expression statement]: statements.html#expression-statements |
| 121 | +[_Statement_]: statements.html |
132 | 122 | [_Expression_]: expressions.html
|
133 | 123 | [expression]: expressions.html
|
134 | 124 | [statements]: statements.html
|
|
0 commit comments