1 #![feature(unboxed_closures)]
3 fn f<F: Fn<usize>>(_: F) {}
5 [1, 2, 3].sort_by(|| panic!());
6 //~^ ERROR closure is expected to take
7 [1, 2, 3].sort_by(|tuple| panic!());
8 //~^ ERROR closure is expected to take
9 [1, 2, 3].sort_by(|(tuple, tuple2)| panic!());
10 //~^ ERROR closure is expected to take
11 [1, 2, 3].sort_by(|(tuple, tuple2): (usize, _)| panic!());
12 //~^ ERROR closure is expected to take
14 //~^ ERROR closure is expected to take
16 //~^ ERROR closure is expected to take
18 let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x| i);
19 //~^ ERROR closure is expected to take
20 let _it = vec![1, 2, 3].into_iter().enumerate().map(|i: usize, x| i);
21 //~^ ERROR closure is expected to take
22 let _it = vec![1, 2, 3].into_iter().enumerate().map(|i, x, y| i);
23 //~^ ERROR closure is expected to take
24 let _it = vec![1, 2, 3].into_iter().enumerate().map(foo);
25 //~^ ERROR function is expected to take
26 let bar = |i, x, y| i;
27 let _it = vec![1, 2, 3].into_iter().enumerate().map(bar);
28 //~^ ERROR closure is expected to take
29 let _it = vec![1, 2, 3].into_iter().enumerate().map(qux);
30 //~^ ERROR function is expected to take
32 let _it = vec![1, 2, 3].into_iter().map(usize::checked_add);
33 //~^ ERROR function is expected to take
36 //~^ ERROR function is expected to take
40 fn qux(x: usize, y: usize) {}
42 fn call<F, R>(_: F) where F: FnOnce() -> R {}