]> git.lizzy.rs Git - rust.git/blob - src/test/ui/mismatched_types/overloaded-calls-bad.rs
Merge commit 'bf1c6f9871f430e284b17aa44059e0d0395e28a6' into clippyup
[rust.git] / src / test / ui / mismatched_types / overloaded-calls-bad.rs
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 {
11     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;
18     extern "rust-call" fn call_once(mut self, (z,): (isize,)) -> isize {
19         self.call_mut((z,))
20     }
21 }
22
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 }