diff --git a/doc/tutorial-borrowed-ptr.md b/doc/tutorial-borrowed-ptr.md index c13b2528598c1..c85178fecc15f 100644 --- a/doc/tutorial-borrowed-ptr.md +++ b/doc/tutorial-borrowed-ptr.md @@ -348,11 +348,11 @@ mutations: ~~~ {.xfail-test} fn example3() -> int { struct R { g: int } - struct S { mut f: ~R } + struct S { f: ~R } - let mut x = ~S {mut f: ~R {g: 3}}; + let mut x = ~S {f: ~R {g: 3}}; let y = &x.f.g; - x = ~S {mut f: ~R {g: 4}}; // Error reported here. + x = ~S {f: ~R {g: 4}}; // Error reported here. x.f = ~R {g: 5}; // Error reported here. *y } @@ -368,8 +368,8 @@ box's owner. Consider a program like this: ~~~ {.xfail-test} struct R { g: int } -struct S { mut f: ~R } -fn example5a(x: @S, callback: @fn()) -> int { +struct S { f: ~R } +fn example5a(x: @mut S, callback: @fn()) -> int { let y = &x.f.g; // Error reported here. ... callback(); @@ -383,11 +383,11 @@ Here the heap looks something like: ~~~ {.notrust} Stack Managed Heap Exchange Heap - x +------+ +-------------+ +------+ - | @... | ----> | mut f: ~... | --+-> | g: 3 | - y +------+ +-------------+ | +------+ - | &int | -------------------------+ - +------+ + x +---------+ +---------+ +------+ + | @mut... | ----> | f: ~... | --+-> | g: 3 | + y +---------+ +---------+ | +------+ + | &int | ---------------------+ + +---------+ ~~~ In this case, the owning reference to the value being borrowed is @@ -423,8 +423,8 @@ onto your stack: ~~~ struct R { g: int } -struct S { mut f: ~R } -fn example5c(x: @S) -> int { +struct S { f: ~R } +fn example5c(x: @mut S) -> int { let mut v = ~R {g: 0}; v <-> x.f; // Swap v and x.f { // Block constrains the scope of `y`: @@ -768,7 +768,7 @@ replaced the `...` with some specific code: ~~~ struct R { g: int } -struct S { mut f: ~R } +struct S { f: ~R } fn example5a(x: @S ...) -> int { let y = &x.f.g; // Unsafe *y + 1 @@ -789,7 +789,7 @@ We can now update `example5a()` to use `add_one()`: ~~~ # struct R { g: int } -# struct S { mut f: ~R } +# struct S { f: ~R } # pure fn add_one(x: &int) -> int { *x + 1 } fn example5a(x: @S ...) -> int { let y = &x.f.g; diff --git a/doc/tutorial-ffi.md b/doc/tutorial-ffi.md index c3def1f4b27c4..d3e559b4f2ae0 100644 --- a/doc/tutorial-ffi.md +++ b/doc/tutorial-ffi.md @@ -220,8 +220,8 @@ extern mod std; use libc::c_ulonglong; struct timeval { - mut tv_sec: c_ulonglong, - mut tv_usec: c_ulonglong + tv_sec: c_ulonglong, + tv_usec: c_ulonglong } #[nolink] @@ -231,8 +231,8 @@ extern mod lib_c { fn unix_time_in_microseconds() -> u64 { unsafe { let x = timeval { - mut tv_sec: 0 as c_ulonglong, - mut tv_usec: 0 as c_ulonglong + tv_sec: 0 as c_ulonglong, + tv_usec: 0 as c_ulonglong }; lib_c::gettimeofday(ptr::addr_of(&x), ptr::null()); return (x.tv_sec as u64) * 1000_000_u64 + (x.tv_usec as u64); diff --git a/doc/tutorial.md b/doc/tutorial.md index 41895ebed7c59..7d627b3786c45 100644 --- a/doc/tutorial.md +++ b/doc/tutorial.md @@ -589,7 +589,7 @@ of its fields nevertheless mutable, using the `mut` keyword. ~~~~ struct Stack { content: ~[int], - mut head: uint + head: uint } ~~~~ @@ -938,19 +938,19 @@ type that contains managed boxes or other managed types. ~~~ // A linked list node struct Node { - mut next: MaybeNode, - mut prev: MaybeNode, - payload: int + next: MaybeNode, + prev: MaybeNode, + payload: int } enum MaybeNode { - SomeNode(@Node), - NoNode + SomeNode(@mut Node), + NoNode } -let node1 = @Node { next: NoNode, prev: NoNode, payload: 1 }; -let node2 = @Node { next: NoNode, prev: NoNode, payload: 2 }; -let node3 = @Node { next: NoNode, prev: NoNode, payload: 3 }; +let node1 = @mut Node { next: NoNode, prev: NoNode, payload: 1 }; +let node2 = @mut Node { next: NoNode, prev: NoNode, payload: 2 }; +let node3 = @mut Node { next: NoNode, prev: NoNode, payload: 3 }; // Link the three list nodes together node1.next = SomeNode(node2); @@ -2300,8 +2300,8 @@ mod farm { # impl Human { fn rest(&self) { } } # pub fn make_me_a_farm() -> farm::Farm { farm::Farm { chickens: ~[], cows: ~[], farmer: Human(0) } } pub struct Farm { - priv mut chickens: ~[Chicken], - priv mut cows: ~[Cow], + priv chickens: ~[Chicken], + priv cows: ~[Cow], farmer: Human }