]> git.lizzy.rs Git - rust.git/blob - src/test/ui/overloaded/overloaded-calls-nontuple.rs
Auto merge of #95454 - randomicon00:fix95444, r=wesleywiser
[rust.git] / src / test / ui / overloaded / overloaded-calls-nontuple.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     //~^^^ ERROR functions with the "rust-call" ABI must take a single non-self argument
15 }
16
17 impl FnOnce<isize> for S {
18     type Output = isize;
19     extern "rust-call" fn call_once(mut self, z: isize) -> isize { self.call_mut(z) }
20     //~^ ERROR functions with the "rust-call" ABI must take a single non-self argument
21 }
22
23 fn main() {
24     let mut s = S {
25         x: 1,
26         y: 2,
27     };
28     drop(s(3))  //~ ERROR cannot use call notation
29 }