summaryrefslogtreecommitdiffstats
path: root/src/test/ui/unboxed-closures/unboxed-closures-prelude.rs
blob: 89a273b7a43ff26e57c09af4559a1320081b13cf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// run-pass
// Tests that the re-exports of `FnOnce` et al from the prelude work.

// pretty-expanded FIXME #23616

fn main() {
    let task: Box<dyn Fn(isize) -> isize> = Box::new(|x| x);
    task(0);

    let mut task: Box<dyn FnMut(isize) -> isize> = Box::new(|x| x);
    task(0);

    call(|x| x, 22);
}

fn call<F:FnOnce(isize) -> isize>(f: F, x: isize) -> isize {
    f(x)
}