Skip to content

Commit c500801

Browse files
committed
Fix typos in section 6; point out that prove expressions are unsupported
1 parent 704210e commit c500801

File tree

1 file changed

+22
-20
lines changed

1 file changed

+22
-20
lines changed

doc/rust.md

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1293,7 +1293,7 @@ A declaration serves to introduce a *name* that can be used in the block
12931293
name, from the previous opening curly-brace (`{`) up to the next closing
12941294
curly-brace (`}`).
12951295

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
12971297
*value*. Expressions are said to *evaluate to* a value, and the side effects
12981298
are caused during *evaluation*. Many expressions contain sub-expressions as
12991299
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
13451345
static type of the slot through unification with the types of values assigned
13461346
to the slot in the remaining code in the block scope. Inference only occurs on
13471347
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.
13491349

13501350

13511351
### Expression statements
@@ -1372,8 +1372,8 @@ string, boolean value, or the nil value.
13721372
### Tuple expressions
13731373

13741374
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.
13771377

13781378
~~~~~~~~ {.tuple}
13791379
(0f, 4.5f);
@@ -1398,9 +1398,9 @@ The order of the fields in a record expression is significant, and
13981398
determines the type of the resulting value. `{a: u8, b: u8}` and `{b:
13991399
u8, a: u8}` are two different fields.
14001400

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
14021402
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
14041404
fields mentioned in the record expression. A new record will be
14051405
created, of the same type as the base expression, with the given
14061406
values for the fields that were explicitly specified, and the values
@@ -1469,7 +1469,7 @@ task in a _failing state_.
14691469

14701470
### Unary operator expressions
14711471

1472-
Rust defines five unary operators. They are all written a prefix
1472+
Rust defines five unary operators. They are all written as prefix
14731473
operators, before the expression they apply to.
14741474

14751475
`-`
@@ -1536,7 +1536,7 @@ type. The first performs the 'or' operation, and the second the 'and'
15361536
operation. They differ from `|` and `&` in that the right-hand operand
15371537
is only evaluated when the left-hand operand does not already
15381538
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`,
15401540
and `&&` only when it evaluates to `true`.
15411541

15421542
#### Comparison operators
@@ -1588,15 +1588,15 @@ types.
15881588

15891589
#### Binary move expressions
15901590

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
15921592
arrow (`<-`) and an *rval* expression.
15931593

15941594
Evaluating a move expression causes, as a side effect, the *rval* to be
15951595
*moved* into the *lval*. If the *rval* was itself an *lval*, it must be a
15961596
local variable, as it will be de-initialized in the process.
15971597

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
16001600
*rval*. Instead, the move expression represents an indivisible *transfer of
16011601
ownership* from the right-hand-side to the left-hand-side of the
16021602
expression. No allocation or destruction is entailed.
@@ -1611,14 +1611,14 @@ x.y <- c;
16111611

16121612
#### Swap expressions
16131613

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
16151615
(`<->`) and another *lval* expression.
16161616

16171617
Evaluating a swap expression causes, as a side effect, the vales held in the
16181618
left-hand-side and right-hand-side *lvals* to be exchanged indivisibly.
16191619

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
16221622
*rval*. Instead, the move expression represents an indivisible *exchange of
16231623
ownership* between the right-hand-side to the left-hand-side of the
16241624
expression. No allocation or destruction is entailed.
@@ -1635,7 +1635,7 @@ x.y <-> a.b;
16351635
#### Assignment expressions
16361636

16371637
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.
16391639

16401640
Evaluating an assignment expression is equivalent to evaluating a [binary move
16411641
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
16801680
some argument expression.
16811681

16821682
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.
16851685

16861686
[Shared boxes](#shared-box-types) (type `@`) are, as usual, shallow-copied, as
16871687
they may be cyclic. [Unique boxes](unique-box-types), [vectors](#vector-types)
16881688
and similar unique types are deep-copied.
16891689

16901690
Since the binary [assignment operator](#assignment-operator) `=` performs a
16911691
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.
16931693

16941694
An example of a copy expression:
16951695

@@ -1709,7 +1709,7 @@ assert v[0] == 1; // Original was not modified
17091709

17101710
This is used to indicate that the referenced _lval_ must be moved out,
17111711
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
17131713
function that takes ownership of it.
17141714

17151715
~~~~
@@ -1777,7 +1777,7 @@ assert (add(4,5) == add5(4));
17771777
17781778
~~~~
17791779

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
17811781
hidden, boxed tuple, owned by the resulting first-class function. For each
17821782
bound slot in the bound function's signature, space is allocated in the hidden
17831783
tuple and populated with a copy of the bound value.
@@ -2132,6 +2132,8 @@ fn test() {
21322132

21332133
### Prove expressions
21342134

2135+
**Note: Prove expressions are not yet supported by the compiler.**
2136+
21352137
A `prove` expression has no run-time effect. Its purpose is to statically
21362138
check (and document) that its argument constraint holds at its expression
21372139
entry point. If its argument typestate does not hold, under the typestate

0 commit comments

Comments
 (0)