@@ -1290,24 +1290,6 @@ Rust has two kinds of statement:
1290
1290
[ declaration statements] ( #declaration-statements ) and
1291
1291
[ expression statements] ( #expression-statements ) .
1292
1292
1293
- A declaration serves to introduce a * name* that can be used in the block
1294
- * scope* enclosing the statement: all statements before and after the
1295
- name, from the previous opening curly-brace (` { ` ) up to the next closing
1296
- curly-brace (` } ` ).
1297
-
1298
- An expression plays the dual roles of causing side effects and producing a
1299
- * value* . Expressions are said to * evaluate to* a value, and the side effects
1300
- are caused during * evaluation* . Many expressions contain sub-expressions as
1301
- operands; the definition of each kind of expression dictates whether or not,
1302
- and in which order, it will evaluate its sub-expressions, and how the
1303
- expression's value derives from the value of its sub-expressions.
1304
-
1305
- In this way, the structure of execution -- both the overall sequence of
1306
- observable side effects and the final produced value -- is dictated by the
1307
- structure of expressions. Blocks themselves are expressions, so the nesting
1308
- sequence of block, statement, expression, and block can repeatedly nest to an
1309
- arbitrary depth.
1310
-
1311
1293
### Declaration statements
1312
1294
1313
1295
A _ declaration statement_ is one that introduces a * name* into the enclosing
@@ -1363,6 +1345,19 @@ the side effects of the expression's evaluation.
1363
1345
1364
1346
## Expressions
1365
1347
1348
+ An expression plays the dual roles of causing side effects and producing a
1349
+ * value* . Expressions are said to * evaluate to* a value, and the side effects
1350
+ are caused during * evaluation* . Many expressions contain sub-expressions as
1351
+ operands; the definition of each kind of expression dictates whether or not,
1352
+ and in which order, it will evaluate its sub-expressions, and how the
1353
+ expression's value derives from the value of its sub-expressions.
1354
+
1355
+ In this way, the structure of execution -- both the overall sequence of
1356
+ observable side effects and the final produced value -- is dictated by the
1357
+ structure of expressions. Blocks themselves are expressions, so the nesting
1358
+ sequence of block, statement, expression, and block can repeatedly nest to an
1359
+ arbitrary depth.
1360
+
1366
1361
### Literal expressions
1367
1362
1368
1363
A _ literal expression_ consists of one of the [ literal] ( #literals )
@@ -1759,7 +1754,7 @@ let x = ~10;
1759
1754
let y = [move x];
1760
1755
~~~~
1761
1756
1762
- Any access to ` y ` after applying the ` move ` operator to it is invalid,
1757
+ Any access to ` x ` after applying the ` move ` operator to it is invalid,
1763
1758
since it is no longer initialized at that point.
1764
1759
1765
1760
### Call expressions
@@ -1770,10 +1765,10 @@ paren_expr_list : '(' expr_list ')' ;
1770
1765
call_expr : expr paren_expr_list ;
1771
1766
~~~~~~~~
1772
1767
1773
- A _ call expression_ invokes a function, providing a tuple of input slots
1774
- and a reference slot to serve as the function's output, bound to the
1775
- ` lval ` on the right hand side of the call. If the function eventually
1776
- returns, then the expression completes.
1768
+ A _ call expression_ invokes a function, providing zero or more input slots and
1769
+ an optional reference slot to serve as the function's output, bound to the
1770
+ ` lval ` on the right hand side of the call. If the function eventually returns,
1771
+ then the expression completes.
1777
1772
1778
1773
A call expression statically requires that the precondition declared in the
1779
1774
callee's signature is satisfied by the expression prestate. In this way,
0 commit comments