]> git.lizzy.rs Git - rust.git/blob - tests/ui/unboxed-closures/unboxed-closures-prelude.rs
Rollup merge of #106856 - vadorovsky:fix-atomic-annotations, r=joshtriplett
[rust.git] / tests / ui / unboxed-closures / unboxed-closures-prelude.rs
1 // run-pass
2 // Tests that the re-exports of `FnOnce` et al from the prelude work.
3
4 // pretty-expanded FIXME #23616
5
6 fn main() {
7     let task: Box<dyn Fn(isize) -> isize> = Box::new(|x| x);
8     task(0);
9
10     let mut task: Box<dyn FnMut(isize) -> isize> = Box::new(|x| x);
11     task(0);
12
13     call(|x| x, 22);
14 }
15
16 fn call<F:FnOnce(isize) -> isize>(f: F, x: isize) -> isize {
17     f(x)
18 }