diff --git a/doc/rust.md b/doc/rust.md index 9982f72ebe7..1189e7dbf22 100644 --- a/doc/rust.md +++ b/doc/rust.md @@ -1234,7 +1234,7 @@ For example: ~~~~ trait Num { - static pure fn from_int(n: int) -> self; + static pure fn from_int(n: int) -> Self; } impl float: Num { static pure fn from_int(n: int) -> float { n as float } @@ -1743,7 +1743,6 @@ task in a _failing state_. # do task::spawn_unlinked { ([1, 2, 3, 4])[0]; -(['x', 'y'])[1] = 'z'; (["a", "b"])[10]; // fails # } @@ -1906,8 +1905,8 @@ No allocation or destruction is entailed. An example of three different swap expressions: ~~~~~~~~ -# let mut x = &[0]; -# let mut a = &[0]; +# let mut x = &mut [0]; +# let mut a = &mut [0]; # let i = 0; # let y = {mut z: 0}; # let b = {mut c: 0}; @@ -2002,7 +2001,7 @@ the unary copy operator is typically only used to cause an argument to a functio An example of a copy expression: ~~~~ -fn mutate(vec: ~[int]) { +fn mutate(mut vec: ~[int]) { vec[0] = 10; } diff --git a/doc/tutorial-tasks.md b/doc/tutorial-tasks.md index 26541eca7d3..98ed6b86584 100644 --- a/doc/tutorial-tasks.md +++ b/doc/tutorial-tasks.md @@ -440,8 +440,8 @@ Finally, tasks can be configured to not propagate failure to each other at all, using `task::spawn_unlinked` for _isolated failure_. ~~~ -# fn random() -> int { 100 } -# fn sleep_for(i: int) { for i.times { task::yield() } } +# fn random() -> uint { 100 } +# fn sleep_for(i: uint) { for i.times { task::yield() } } # do task::try::<()> { let (time1, time2) = (random(), random()); do task::spawn_unlinked {