2016-11-10 11:08:21 -06:00
|
|
|
#![feature(fn_traits, unboxed_closures)]
|
2014-06-01 18:35:01 -05:00
|
|
|
|
|
|
|
use std::ops::FnMut;
|
|
|
|
|
|
|
|
struct S {
|
2015-01-08 04:54:35 -06:00
|
|
|
x: isize,
|
|
|
|
y: isize,
|
2014-06-01 18:35:01 -05:00
|
|
|
}
|
|
|
|
|
2015-01-12 09:27:25 -06:00
|
|
|
impl FnMut<isize> for S {
|
2022-07-30 00:37:48 -05:00
|
|
|
//~^ ERROR type parameter to bare `FnMut` trait must be a tuple
|
2015-01-08 04:54:35 -06:00
|
|
|
extern "rust-call" fn call_mut(&mut self, z: isize) -> isize {
|
2022-07-30 00:37:48 -05:00
|
|
|
//~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument
|
2014-06-01 18:35:01 -05:00
|
|
|
self.x + self.y + z
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2015-03-11 09:08:33 -05:00
|
|
|
impl FnOnce<isize> for S {
|
2022-07-30 00:37:48 -05:00
|
|
|
//~^ ERROR type parameter to bare `FnOnce` trait must be a tuple
|
2015-03-11 09:08:33 -05:00
|
|
|
type Output = isize;
|
2022-07-30 00:37:48 -05:00
|
|
|
extern "rust-call" fn call_once(mut self, z: isize) -> isize {
|
|
|
|
//~^ ERROR functions with the "rust-call" ABI must take a single non-self tuple argument
|
|
|
|
self.call_mut(z)
|
|
|
|
}
|
2015-03-11 09:08:33 -05:00
|
|
|
}
|
|
|
|
|
2014-06-01 18:35:01 -05:00
|
|
|
fn main() {
|
2022-07-30 00:37:48 -05:00
|
|
|
let mut s = S { x: 1, y: 2 };
|
|
|
|
drop(s(3))
|
2014-06-01 18:35:01 -05:00
|
|
|
}
|