diff --git a/doc/tutorial-borrowed-ptr.md b/doc/tutorial-borrowed-ptr.md index 4866f7b8f5e..59d58cadbec 100644 --- a/doc/tutorial-borrowed-ptr.md +++ b/doc/tutorial-borrowed-ptr.md @@ -302,7 +302,7 @@ rejected by the compiler): fn example3() -> int { let mut x = ~X {f: 3}; let y = &x.f; - x = ~{f: 4}; // Error reported here. + x = ~X {f: 4}; // Error reported here. *y } ~~~ @@ -369,9 +369,11 @@ box's owner. Consider a program like this: ~~~ struct R { g: int } struct S { mut f: ~R } -fn example5a(x: @S ...) -> int { +fn example5a(x: @S, callback: @fn()) -> int { let y = &x.f.g; // Error reported here. ... + callback(); + ... # return 0; } ~~~