Rollup merge of #22267 - steveklabnik:fix_lie, r=Gankro
Otherwise, this line is a lie.
This commit is contained in:
commit
11c70a3b09
1 changed files with 7 additions and 2 deletions
|
@ -687,7 +687,9 @@ than the hundred `int`s that make up the `BigStruct`.
|
||||||
|
|
||||||
This is an antipattern in Rust. Instead, write this:
|
This is an antipattern in Rust. Instead, write this:
|
||||||
|
|
||||||
```{rust}
|
```rust
|
||||||
|
#![feature(box_syntax)]
|
||||||
|
|
||||||
struct BigStruct {
|
struct BigStruct {
|
||||||
one: i32,
|
one: i32,
|
||||||
two: i32,
|
two: i32,
|
||||||
|
@ -706,10 +708,13 @@ fn main() {
|
||||||
one_hundred: 100,
|
one_hundred: 100,
|
||||||
});
|
});
|
||||||
|
|
||||||
let y = Box::new(foo(x));
|
let y = box foo(x);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Note that this uses the `box_syntax` feature gate, so this syntax may change in
|
||||||
|
the future.
|
||||||
|
|
||||||
This gives you flexibility without sacrificing performance.
|
This gives you flexibility without sacrificing performance.
|
||||||
|
|
||||||
You may think that this gives us terrible performance: return a value and then
|
You may think that this gives us terrible performance: return a value and then
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue