2015-04-14 05:49:26 -05:00
|
|
|
// Regression test for #23827
|
|
|
|
|
2016-11-10 11:08:21 -06:00
|
|
|
#![feature(core, fn_traits, unboxed_closures)]
|
2015-04-14 05:49:26 -05:00
|
|
|
|
|
|
|
pub struct Prototype {
|
|
|
|
pub target: u32
|
|
|
|
}
|
|
|
|
|
|
|
|
trait Component {
|
|
|
|
fn apply(self, e: u32);
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<C: Component> Fn<(C,)> for Prototype {
|
|
|
|
extern "rust-call" fn call(&self, (comp,): (C,)) -> Prototype {
|
|
|
|
comp.apply(self.target);
|
|
|
|
*self
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<C: Component> FnMut<(C,)> for Prototype {
|
|
|
|
extern "rust-call" fn call_mut(&mut self, (comp,): (C,)) -> Prototype {
|
|
|
|
Fn::call(*&self, (comp,))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<C: Component> FnOnce<(C,)> for Prototype {
|
2016-08-04 23:21:24 -05:00
|
|
|
//~^ ERROR E0046
|
2015-04-14 05:49:26 -05:00
|
|
|
extern "rust-call" fn call_once(self, (comp,): (C,)) -> Prototype {
|
|
|
|
Fn::call(&self, (comp,))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|