Skip to content

Commit ef880f2

Browse files
committed
doc: Fix broken examples
1 parent 02b1c32 commit ef880f2

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/rust.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1027,9 +1027,9 @@ pure fn lt_42(x: int) -> bool {
10271027
Pure functions may call other pure functions:
10281028

10291029
~~~~{.xfail-test}
1030-
pure fn pure_length<T>(ls: list<T>) -> uint { /* ... */ }
1030+
pure fn pure_length<T>(ls: List<T>) -> uint { /* ... */ }
10311031
1032-
pure fn nonempty_list<T>(ls: list<T>) -> bool { pure_length(ls) > 0u }
1032+
pure fn nonempty_list<T>(ls: List<T>) -> bool { pure_length(ls) > 0u }
10331033
~~~~
10341034

10351035
*TODO:* should actually define referential transparency.
@@ -1055,14 +1055,14 @@ An example of a pure function that uses an unchecked block:
10551055
~~~~
10561056
# import std::list::*;
10571057
1058-
fn pure_foldl<T, U: copy>(ls: list<T>, u: U, f: fn(&&T, &&U) -> U) -> U {
1058+
fn pure_foldl<T, U: copy>(ls: List<T>, u: U, f: fn(&&T, &&U) -> U) -> U {
10591059
match ls {
1060-
nil => u,
1061-
cons(hd, tl) => f(hd, pure_foldl(*tl, f(hd, u), f))
1060+
Nil => u,
1061+
Cons(hd, tl) => f(hd, pure_foldl(*tl, f(hd, u), f))
10621062
}
10631063
}
10641064
1065-
pure fn pure_length<T>(ls: list<T>) -> uint {
1065+
pure fn pure_length<T>(ls: List<T>) -> uint {
10661066
fn count<T>(_t: T, &&u: uint) -> uint { u + 1u }
10671067
unchecked {
10681068
pure_foldl(ls, 0u, count)

0 commit comments

Comments
 (0)