summaryrefslogtreecommitdiff
path: root/tests/ui/issues/issue-20544.rs
blob: 2aaae17294d3e03b3f444ad37f05c7673ec4e4e9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//@ run-pass
#![feature(unboxed_closures)]
#![feature(fn_traits)]

struct Fun<F>(F);

impl<F, T> FnOnce<(T,)> for Fun<F> where F: Fn(T) -> T {
    type Output = T;

    extern "rust-call" fn call_once(self, (t,): (T,)) -> T {
        (self.0)(t)
    }
}

fn main() {
    let fun = Fun(|i: isize| i * 2);
    println!("{}", fun(3));
}