]>
Commit | Line | Data |
---|---|---|
476ff2be | 1 | #![feature(fn_traits, unboxed_closures)] |
223e47cc | 2 | |
1a4d82fc | 3 | use std::ops::FnMut; |
223e47cc LB |
4 | |
5 | struct S { | |
1a4d82fc JJ |
6 | x: isize, |
7 | y: isize, | |
223e47cc LB |
8 | } |
9 | ||
85aaf69f | 10 | impl FnMut<isize> for S { |
1a4d82fc JJ |
11 | extern "rust-call" fn call_mut(&mut self, z: isize) -> isize { |
12 | self.x + self.y + z | |
13 | } | |
223e47cc LB |
14 | } |
15 | ||
c34b1796 AL |
16 | impl FnOnce<isize> for S { |
17 | type Output = isize; | |
18 | extern "rust-call" fn call_once(mut self, z: isize) -> isize { self.call_mut(z) } | |
19 | } | |
20 | ||
1a4d82fc JJ |
21 | fn main() { |
22 | let mut s = S { | |
23 | x: 1, | |
24 | y: 2, | |
223e47cc | 25 | }; |
1a4d82fc | 26 | drop(s(3)) //~ ERROR cannot use call notation |
223e47cc | 27 | } |