]> git.lizzy.rs Git - rust.git/blob - src/doc/unstable-book/src/language-features/unboxed-closures.md
Rollup merge of #106904 - khuey:preserve_debuginfo_for_rlibs, r=davidtwco
[rust.git] / src / doc / unstable-book / src / language-features / unboxed-closures.md
1 # `unboxed_closures`
2
3 The tracking issue for this feature is [#29625]
4
5 See Also: [`fn_traits`](../library-features/fn-traits.md)
6
7 [#29625]: https://github.com/rust-lang/rust/issues/29625
8
9 ----
10
11 The `unboxed_closures` feature allows you to write functions using the `"rust-call"` ABI,
12 required for implementing the [`Fn*`] family of traits. `"rust-call"` functions must have
13 exactly one (non self) argument, a tuple representing the argument list.
14
15 [`Fn*`]: ../../std/ops/trait.Fn.html
16
17 ```rust
18 #![feature(unboxed_closures)]
19
20 extern "rust-call" fn add_args(args: (u32, u32)) -> u32 {
21     args.0 + args.1
22 }
23
24 fn main() {}
25 ```