]> git.lizzy.rs Git - rust.git/blob - tests/ui/issues/issue-20544.rs
Rollup merge of #104965 - zacklukem:p-option-as_ref-docs, r=scottmcm
[rust.git] / tests / ui / issues / issue-20544.rs
1 // run-pass
2 #![feature(unboxed_closures)]
3 #![feature(fn_traits)]
4
5 struct Fun<F>(F);
6
7 impl<F, T> FnOnce<(T,)> for Fun<F> where F: Fn(T) -> T {
8     type Output = T;
9
10     extern "rust-call" fn call_once(self, (t,): (T,)) -> T {
11         (self.0)(t)
12     }
13 }
14
15 fn main() {
16     let fun = Fun(|i: isize| i * 2);
17     println!("{}", fun(3));
18 }