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