]> git.proxmox.com Git - rustc.git/blob - src/doc/unstable-book/src/box-syntax.md
New upstream version 1.17.0+dfsg1
[rustc.git] / src / doc / unstable-book / src / box-syntax.md
1 # `box_syntax`
2
3 The tracking issue for this feature is: [#27779]
4
5 [#27779]: https://github.com/rust-lang/rust/issues/27779
6
7 See also [`box_patterns`](box-patterns.html)
8
9 ------------------------
10
11 Currently the only stable way to create a `Box` is via the `Box::new` method.
12 Also it is not possible in stable Rust to destructure a `Box` in a match
13 pattern. The unstable `box` keyword can be used to create a `Box`. An example
14 usage would be:
15
16 ```rust
17 #![feature(box_syntax)]
18
19 fn main() {
20 let b = box 5;
21 }
22 ```