2015-04-14 10:49:26 +00:00
|
|
|
// Regression test for #23827
|
|
|
|
|
2022-01-19 15:24:49 +00:00
|
|
|
#![feature(fn_traits, unboxed_closures)]
|
2015-04-14 10:49:26 +00:00
|
|
|
|
2024-02-01 22:45:00 +00:00
|
|
|
#[derive(Copy, Clone)]
|
2015-04-14 10:49:26 +00: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-05 04:21:24 +00:00
|
|
|
//~^ ERROR E0046
|
2015-04-14 10:49:26 +00:00
|
|
|
extern "rust-call" fn call_once(self, (comp,): (C,)) -> Prototype {
|
|
|
|
Fn::call(&self, (comp,))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|