1 #![feature(fn_traits, unboxed_closures)]
2
3 use std::ops::FnMut;
4
5 struct S {
6 x: isize,
7 y: isize,
8 }
9
10 impl FnMut<(isize,)> for S {
call_mut(&mut self, (z,): (isize,)) -> isize11 extern "rust-call" fn call_mut(&mut self, (z,): (isize,)) -> isize {
12 self.x * self.y * z
13 }
14 }
15
16 impl FnOnce<(isize,)> for S {
17 type Output = isize;
call_once(mut self, (z,): (isize,)) -> isize18 extern "rust-call" fn call_once(mut self, (z,): (isize,)) -> isize {
19 self.call_mut((z,))
20 }
21 }
22
main()23 fn main() {
24 let mut s = S {
25 x: 3,
26 y: 3,
27 };
28 let ans = s("what"); //~ ERROR mismatched types
29 let ans = s();
30 //~^ ERROR this function takes 1 argument but 0 arguments were supplied
31 let ans = s("burma", "shave");
32 //~^ ERROR this function takes 1 argument but 2 arguments were supplied
33 }
34