diff options
| author | Ulysse Carion <ulysse@ulysse.io> | 2014-11-25 16:32:53 -0800 |
|---|---|---|
| committer | Ulysse Carion <ulysse@ulysse.io> | 2014-11-25 16:32:53 -0800 |
| commit | 6cb03baffa329f785bdef4079456dc85ec3b0bbc (patch) | |
| tree | 3efb87dd07597969945fd752903fd392ae73e4ab /src/doc/guide-pointers.md | |
| parent | 0e06f71747749e33ca590c334658bddde97a7e54 (diff) | |
| download | rust-6cb03baffa329f785bdef4079456dc85ec3b0bbc.tar.gz rust-6cb03baffa329f785bdef4079456dc85ec3b0bbc.zip | |
Fix formatting of the pointers guide.
Diffstat (limited to 'src/doc/guide-pointers.md')
| -rw-r--r-- | src/doc/guide-pointers.md | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/doc/guide-pointers.md b/src/doc/guide-pointers.md index cf7ecd7e51f..08d7c2a4158 100644 --- a/src/doc/guide-pointers.md +++ b/src/doc/guide-pointers.md @@ -572,7 +572,7 @@ fn add_one(x: &mut int) -> int { fn main() { let x = box 5i; - println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference + println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference // of `&`-pointer as mutable } ``` @@ -700,9 +700,9 @@ This gives you flexibility without sacrificing performance. You may think that this gives us terrible performance: return a value and then immediately box it up ?! Isn't that the worst of both worlds? Rust is smarter -than that. There is no copy in this code. main allocates enough room for the -`box , passes a pointer to that memory into foo as x, and then foo writes the -value straight into that pointer. This writes the return value directly into +than that. There is no copy in this code. `main` allocates enough room for the +`box`, passes a pointer to that memory into `foo` as `x`, and then `foo` writes +the value straight into that pointer. This writes the return value directly into the allocated box. This is important enough that it bears repeating: pointers are not for |
