Skip to content

Commit 18e6f6d

Browse files
author
alexrp
committed
---
yaml --- r: 31730 b: refs/heads/dist-snap c: 11c1baa h: refs/heads/master v: v3
1 parent 21592fa commit 18e6f6d

File tree

2 files changed

+5
-30
lines changed

2 files changed

+5
-30
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@ refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df
99
refs/heads/incoming: d9317a174e434d4c99fc1a37fd7dc0d2f5328d37
10-
refs/heads/dist-snap: 81aef34a5acd8c546992e100defb6f769b46d9d7
10+
refs/heads/dist-snap: 11c1baa883d95e790aaa1fd4f88bcb36517a27b8
1111
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1212
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/dist-snap/doc/rust.md

Lines changed: 4 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1129,8 +1129,8 @@ looks like:
11291129

11301130
The only exception is that the body of the class constructor begins
11311131
with all the class's fields uninitialized, and is allowed to -- in
1132-
fact, must -- initialize all the fields. A special case in the
1133-
typestate pass enforces this invariant.
1132+
fact, must -- initialize all the fields. The compiler enforces this
1133+
invariant.
11341134

11351135
Usually, the class constructor stores its argument or arguments in the
11361136
class's named fields. In this case, the `file_descriptor`'s data field
@@ -2067,31 +2067,6 @@ A `loop` expression denotes an infinite loop:
20672067
loop_expr : "loop" '{' block '}';
20682068
~~~~~~~~
20692069

2070-
For a block `b`, the expression `loop b` is semantically equivalent to
2071-
`while true b`. However, `loop`s differ from `while` loops in that the
2072-
typestate analysis pass takes into account that `loop`s are infinite.
2073-
2074-
For example, the following (contrived) function uses a `loop` with a
2075-
`return` expression:
2076-
2077-
~~~~
2078-
fn count() -> bool {
2079-
let mut i = 0;
2080-
loop {
2081-
i += 1;
2082-
if i == 20 { return true; }
2083-
}
2084-
}
2085-
~~~~
2086-
2087-
This function compiles, because typestate recognizes that the `loop`
2088-
never terminates (except non-locally, with `return`), thus there is no
2089-
need to insert a spurious `fail` or `return` after the `loop`. If `loop`
2090-
were replaced with `while true`, the function would be rejected
2091-
because from the compiler's perspective, there would be a control path
2092-
along which `count` does not return a value (that is, if the loop
2093-
condition is always false).
2094-
20952070
### Break expressions
20962071

20972072
~~~~~~~~{.ebnf .gram}
@@ -2533,7 +2508,7 @@ macro-generated and user-written code can cause unintentional capture.
25332508
Future versions of Rust will address these issues.
25342509

25352510

2536-
# Types and typestates
2511+
# Type system
25372512

25382513
## Types
25392514

@@ -2959,7 +2934,7 @@ Local variables are not initialized when allocated; the entire frame worth of
29592934
local variables are allocated at once, on frame-entry, in an uninitialized
29602935
state. Subsequent statements within a function may or may not initialize the
29612936
local variables. Local variables can be used only after they have been
2962-
initialized; this condition is guaranteed by the typestate system.
2937+
initialized; this is enforced by the compiler.
29632938

29642939
References are created for function arguments. If the compiler can not prove
29652940
that the referred-to value will outlive the reference, it will try to set

0 commit comments

Comments
 (0)