Skip to content

Commit 5ce1b33

Browse files
committed
Reintroduce box syntax where needed
Otherwise, this line is a lie.
1 parent cf636c2 commit 5ce1b33

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/doc/trpl/pointers.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -687,7 +687,9 @@ than the hundred `int`s that make up the `BigStruct`.
687687

688688
This is an antipattern in Rust. Instead, write this:
689689

690-
```{rust}
690+
```rust
691+
#![feature(box_syntax)]
692+
691693
struct BigStruct {
692694
one: i32,
693695
two: i32,
@@ -706,10 +708,13 @@ fn main() {
706708
one_hundred: 100,
707709
});
708710

709-
let y = Box::new(foo(x));
711+
let y = box foo(x);
710712
}
711713
```
712714

715+
Note that this uses the `box_syntax` feature gate, so this syntax may change in
716+
the future.
717+
713718
This gives you flexibility without sacrificing performance.
714719

715720
You may think that this gives us terrible performance: return a value and then

0 commit comments

Comments
 (0)