Skip to content

Commit e69cc80

Browse files
committed
---
yaml --- r: 28570 b: refs/heads/try c: 5e9d38e h: refs/heads/master v: v3
1 parent c69050b commit e69cc80

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
refs/heads/master: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
33
refs/heads/snap-stage1: e33de59e47c5076a89eadeb38f4934f58a3618a6
44
refs/heads/snap-stage3: cd6f24f9d14ac90d167386a56e7a6ac1f0318195
5-
refs/heads/try: 76c8b83efad38b05c5f4d140b8084dcb7b75fc38
5+
refs/heads/try: 5e9d38ede0f0eff5fec3ad8713897c080211d5ea
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
88
refs/heads/try2: d0c6ce338884ee21843f4b40bf6bf18d222ce5df

branches/try/doc/rust.md

Lines changed: 17 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -222,7 +222,7 @@ pure
222222
return
223223
struct
224224
true trait type
225-
unchecked unsafe
225+
unsafe
226226
while
227227
~~~~~~~~
228228

@@ -1035,23 +1035,24 @@ pure fn nonempty_list<T>(ls: List<T>) -> bool { pure_length(ls) > 0u }
10351035

10361036
*TODO:* should actually define referential transparency.
10371037

1038-
The effect checking rules previously enumerated are a restricted set of
1039-
typechecking rules meant to approximate the universe of observably
1040-
referentially transparent Rust procedures conservatively. Sometimes, these
1041-
rules are *too* restrictive. Rust allows programmers to violate these rules by
1042-
writing pure functions that the compiler cannot prove to be referentially
1043-
transparent, using an escape-hatch feature called "unchecked blocks". When
1044-
writing code that uses unchecked blocks, programmers should always be aware
1045-
that they have an obligation to show that the code *behaves* referentially
1046-
transparently at all times, even if the compiler cannot *prove* automatically
1047-
that the code is referentially transparent. In the presence of unchecked
1048-
blocks, the compiler provides no static guarantee that the code will behave as
1049-
expected at runtime. Rather, the programmer has an independent obligation to
1050-
verify the semantics of the pure functions they write.
1038+
The effect checking rules previously enumerated are a restricted set
1039+
of typechecking rules meant to approximate the universe of observably
1040+
referentially transparent Rust procedures conservatively. Sometimes,
1041+
these rules are *too* restrictive. Rust allows programmers to violate
1042+
these rules by writing pure functions that the compiler cannot prove
1043+
to be referentially transparent, using "unsafe blocks". When writing
1044+
code that uses unsafe blocks, programmers should always be aware that
1045+
they have an obligation to show that the code *behaves* referentially
1046+
transparently at all times, even if the compiler cannot *prove*
1047+
automatically that the code is referentially transparent. In the
1048+
presence of unsafe blocks, the compiler provides no static guarantee
1049+
that the code will behave as expected at runtime. Rather, the
1050+
programmer has an independent obligation to verify the semantics of
1051+
the pure functions they write.
10511052

10521053
*TODO:* last two sentences are vague.
10531054

1054-
An example of a pure function that uses an unchecked block:
1055+
An example of a pure function that uses an unsafe block:
10551056

10561057
~~~~
10571058
# use std::list::*;
@@ -1065,7 +1066,7 @@ fn pure_foldl<T, U: Copy>(ls: List<T>, u: U, f: fn(&&T, &&U) -> U) -> U {
10651066
10661067
pure fn pure_length<T>(ls: List<T>) -> uint {
10671068
fn count<T>(_t: T, &&u: uint) -> uint { u + 1u }
1068-
unchecked {
1069+
unsafe {
10691070
pure_foldl(ls, 0u, count)
10701071
}
10711072
}

0 commit comments

Comments
 (0)