File tree 1 file changed +4
-4
lines changed
1 file changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -572,7 +572,7 @@ fn add_one(x: &mut int) -> int {
572
572
fn main() {
573
573
let x = box 5i;
574
574
575
- println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference
575
+ println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference
576
576
// of `&`-pointer as mutable
577
577
}
578
578
```
@@ -700,9 +700,9 @@ This gives you flexibility without sacrificing performance.
700
700
701
701
You may think that this gives us terrible performance: return a value and then
702
702
immediately box it up ?! Isn't that the worst of both worlds? Rust is smarter
703
- than that. There is no copy in this code. main allocates enough room for the
704
- `box , passes a pointer to that memory into foo as x , and then foo writes the
705
- value straight into that pointer. This writes the return value directly into
703
+ than that. There is no copy in this code. ` main ` allocates enough room for the
704
+ ` box ` , passes a pointer to that memory into ` foo ` as ` x ` , and then ` foo ` writes
705
+ the value straight into that pointer. This writes the return value directly into
706
706
the allocated box.
707
707
708
708
This is important enough that it bears repeating: pointers are not for
You can’t perform that action at this time.
0 commit comments