Skip to content

Commit 9c27ab6

Browse files
committed
rollup merge of #19325: ucarion/pointers-doc-formatting
The "Returning Pointers" section of the pointers guide broke from the convention of putting code between backticks. This PR fixes that. There's also a little trailing whitespace I took care of.
2 parents 4c5b966 + 6cb03ba commit 9c27ab6

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/doc/guide-pointers.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -593,7 +593,7 @@ fn add_one(x: &mut int) -> int {
593593
fn main() {
594594
let x = box 5i;
595595
596-
println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference
596+
println!("{}", add_one(&*x)); // error: cannot borrow immutable dereference
597597
// of `&`-pointer as mutable
598598
}
599599
```
@@ -721,9 +721,9 @@ This gives you flexibility without sacrificing performance.
721721

722722
You may think that this gives us terrible performance: return a value and then
723723
immediately box it up ?! Isn't that the worst of both worlds? Rust is smarter
724-
than that. There is no copy in this code. main allocates enough room for the
725-
`box , passes a pointer to that memory into foo as x, and then foo writes the
726-
value straight into that pointer. This writes the return value directly into
724+
than that. There is no copy in this code. `main` allocates enough room for the
725+
`box`, passes a pointer to that memory into `foo` as `x`, and then `foo` writes
726+
the value straight into that pointer. This writes the return value directly into
727727
the allocated box.
728728

729729
This is important enough that it bears repeating: pointers are not for

0 commit comments

Comments
 (0)