@@ -1293,7 +1293,7 @@ A declaration serves to introduce a *name* that can be used in the block
1293
1293
name, from the previous opening curly-brace (` { ` ) up to the next closing
1294
1294
curly-brace (` } ` ).
1295
1295
1296
- An expression serves the dual roles of causing side effects and producing a
1296
+ An expression plays the dual roles of causing side effects and producing a
1297
1297
* value* . Expressions are said to * evaluate to* a value, and the side effects
1298
1298
are caused during * evaluation* . Many expressions contain sub-expressions as
1299
1299
operands; the definition of each kind of expression dictates whether or not,
@@ -1345,7 +1345,7 @@ The former form, with no type annotation, causes the compiler to infer the
1345
1345
static type of the slot through unification with the types of values assigned
1346
1346
to the slot in the remaining code in the block scope. Inference only occurs on
1347
1347
frame-local slots, not argument slots. Function signatures must
1348
- always declared types for all argument slots.
1348
+ always declare types for all argument slots.
1349
1349
1350
1350
1351
1351
### Expression statements
@@ -1372,8 +1372,8 @@ string, boolean value, or the nil value.
1372
1372
### Tuple expressions
1373
1373
1374
1374
Tuples are written by enclosing two or more comma-separated
1375
- expressions in parentheses. They are used to create [ tuple
1376
- typed ] ( #tuple-types ) values.
1375
+ expressions in parentheses. They are used to create [ tuple-typed ] ( #tuple-types )
1376
+ values.
1377
1377
1378
1378
~~~~~~~~ {.tuple}
1379
1379
(0f, 4.5f);
@@ -1398,9 +1398,9 @@ The order of the fields in a record expression is significant, and
1398
1398
determines the type of the resulting value. ` {a: u8, b: u8} ` and `{b:
1399
1399
u8, a: u8}` are two different fields.
1400
1400
1401
- A record expression can be ended with the word ` with ` followed by an
1401
+ A record expression can terminate with the word ` with ` followed by an
1402
1402
expression to denote a functional update. The expression following
1403
- ` with ` (the base) be of a record type that includes at least all the
1403
+ ` with ` (the base) must be of a record type that includes at least all the
1404
1404
fields mentioned in the record expression. A new record will be
1405
1405
created, of the same type as the base expression, with the given
1406
1406
values for the fields that were explicitly specified, and the values
@@ -1469,7 +1469,7 @@ task in a _failing state_.
1469
1469
1470
1470
### Unary operator expressions
1471
1471
1472
- Rust defines five unary operators. They are all written a prefix
1472
+ Rust defines five unary operators. They are all written as prefix
1473
1473
operators, before the expression they apply to.
1474
1474
1475
1475
` - `
@@ -1536,7 +1536,7 @@ type. The first performs the 'or' operation, and the second the 'and'
1536
1536
operation. They differ from ` | ` and ` & ` in that the right-hand operand
1537
1537
is only evaluated when the left-hand operand does not already
1538
1538
determine the outcome of the expression. That is, ` || ` only evaluates
1539
- it right-hand operand when the left-hand operand evaluates to ` false ` ,
1539
+ its right-hand operand when the left-hand operand evaluates to ` false ` ,
1540
1540
and ` && ` only when it evaluates to ` true ` .
1541
1541
1542
1542
#### Comparison operators
@@ -1588,15 +1588,15 @@ types.
1588
1588
1589
1589
#### Binary move expressions
1590
1590
1591
- A _ binary move experssion _ consists of an * lval* followed by a left-pointing
1591
+ A _ binary move expression _ consists of an * lval* followed by a left-pointing
1592
1592
arrow (` <- ` ) and an * rval* expression.
1593
1593
1594
1594
Evaluating a move expression causes, as a side effect, the * rval* to be
1595
1595
* moved* into the * lval* . If the * rval* was itself an * lval* , it must be a
1596
1596
local variable, as it will be de-initialized in the process.
1597
1597
1598
- Evaluating a move expression does not effect reference counts nor does it
1599
- cause a deep copy of any unique structure pointed- to by the moved
1598
+ Evaluating a move expression does not change reference counts, nor does it
1599
+ cause a deep copy of any unique structure pointed to by the moved
1600
1600
* rval* . Instead, the move expression represents an indivisible * transfer of
1601
1601
ownership* from the right-hand-side to the left-hand-side of the
1602
1602
expression. No allocation or destruction is entailed.
@@ -1611,14 +1611,14 @@ x.y <- c;
1611
1611
1612
1612
#### Swap expressions
1613
1613
1614
- A _ swap experssion _ consists of an * lval* followed by a bi-directional arrow
1614
+ A _ swap expression _ consists of an * lval* followed by a bi-directional arrow
1615
1615
(` <-> ` ) and another * lval* expression.
1616
1616
1617
1617
Evaluating a swap expression causes, as a side effect, the vales held in the
1618
1618
left-hand-side and right-hand-side * lvals* to be exchanged indivisibly.
1619
1619
1620
- Evaluating a move expression does not effect reference counts nor does it
1621
- cause a deep copy of any unique structure pointed- to by the moved
1620
+ Evaluating a move expression does not change reference counts, nor does it
1621
+ cause a deep copy of any unique structure pointed to by the moved
1622
1622
* rval* . Instead, the move expression represents an indivisible * exchange of
1623
1623
ownership* between the right-hand-side to the left-hand-side of the
1624
1624
expression. No allocation or destruction is entailed.
@@ -1635,7 +1635,7 @@ x.y <-> a.b;
1635
1635
#### Assignment expressions
1636
1636
1637
1637
An _ assignment expression_ consists of an * lval* expression followed by an
1638
- equals- sign (` = ` ) and an * rval* expression.
1638
+ equals sign (` = ` ) and an * rval* expression.
1639
1639
1640
1640
Evaluating an assignment expression is equivalent to evaluating a [ binary move
1641
1641
expression] ( #binary-move-expressions ) applied to a [ unary copy
@@ -1680,16 +1680,16 @@ A _unary copy expression_ consists of the unary `copy` operator applied to
1680
1680
some argument expression.
1681
1681
1682
1682
Evaluating a copy expression first evaluates the argument expression, then
1683
- performs a copy of the resulting value, allocating any memory necessary to
1684
- hold the new copy.
1683
+ copies the resulting value, allocating any memory necessary to hold the new
1684
+ copy.
1685
1685
1686
1686
[ Shared boxes] ( #shared-box-types ) (type ` @ ` ) are, as usual, shallow-copied, as
1687
1687
they may be cyclic. [ Unique boxes] ( unique-box-types ) , [ vectors] ( #vector-types )
1688
1688
and similar unique types are deep-copied.
1689
1689
1690
1690
Since the binary [ assignment operator] ( #assignment-operator ) ` = ` performs a
1691
1691
copy implicitly, the unary copy operator is typically only used to cause an
1692
- argument to a function should be copied, and the copy passed by- value.
1692
+ argument to a function to be copied and passed by value.
1693
1693
1694
1694
An example of a copy expression:
1695
1695
@@ -1709,7 +1709,7 @@ assert v[0] == 1; // Original was not modified
1709
1709
1710
1710
This is used to indicate that the referenced _ lval_ must be moved out,
1711
1711
rather than copied, when evaluating this expression. It will only have
1712
- effect when the expression is _ stored_ somewhere or passed to a
1712
+ an effect when the expression is _ stored_ somewhere or passed to a
1713
1713
function that takes ownership of it.
1714
1714
1715
1715
~~~~
@@ -1777,7 +1777,7 @@ assert (add(4,5) == add5(4));
1777
1777
1778
1778
~~~~
1779
1779
1780
- A ` bind ` expression generally stores a copy of the bound arguments in the
1780
+ A ` bind ` expression generally stores a copy of the bound arguments in a
1781
1781
hidden, boxed tuple, owned by the resulting first-class function. For each
1782
1782
bound slot in the bound function's signature, space is allocated in the hidden
1783
1783
tuple and populated with a copy of the bound value.
@@ -2132,6 +2132,8 @@ fn test() {
2132
2132
2133
2133
### Prove expressions
2134
2134
2135
+ ** Note: Prove expressions are not yet supported by the compiler.**
2136
+
2135
2137
A ` prove ` expression has no run-time effect. Its purpose is to statically
2136
2138
check (and document) that its argument constraint holds at its expression
2137
2139
entry point. If its argument typestate does not hold, under the typestate
0 commit comments