]> git.lizzy.rs Git - rust.git/blob - src/doc/unstable-book/src/language-features/box-syntax.md
Rollup merge of #106904 - khuey:preserve_debuginfo_for_rlibs, r=davidtwco
[rust.git] / src / doc / unstable-book / src / language-features / box-syntax.md
1 # `box_syntax`
2
3 The tracking issue for this feature is: [#49733]
4
5 [#49733]: https://github.com/rust-lang/rust/issues/49733
6
7 See also [`box_patterns`](box-patterns.md)
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 ```