2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2015-03-22 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-12-02 17:31:49 -08:00
|
|
|
#![feature(fn_traits, unboxed_closures)]
|
2014-06-17 15:21:28 -04:00
|
|
|
|
2015-02-12 10:29:52 -05:00
|
|
|
trait Foo { fn dummy(&self) { }}
|
2014-06-17 15:21:28 -04:00
|
|
|
|
|
|
|
struct Bar;
|
|
|
|
|
2019-05-28 14:47:21 -04:00
|
|
|
impl<'a> std::ops::Fn<(&'a (dyn Foo+'a),)> for Bar {
|
|
|
|
extern "rust-call" fn call(&self, _: (&'a dyn Foo,)) {}
|
2014-06-17 15:21:28 -04:00
|
|
|
}
|
|
|
|
|
2019-05-28 14:47:21 -04:00
|
|
|
impl<'a> std::ops::FnMut<(&'a (dyn Foo+'a),)> for Bar {
|
|
|
|
extern "rust-call" fn call_mut(&mut self, a: (&'a dyn Foo,)) { self.call(a) }
|
2015-03-11 10:08:33 -04:00
|
|
|
}
|
|
|
|
|
2019-05-28 14:47:21 -04:00
|
|
|
impl<'a> std::ops::FnOnce<(&'a (dyn Foo+'a),)> for Bar {
|
2015-03-11 10:08:33 -04:00
|
|
|
type Output = ();
|
2019-05-28 14:47:21 -04:00
|
|
|
extern "rust-call" fn call_once(self, a: (&'a dyn Foo,)) { self.call(a) }
|
2015-03-11 10:08:33 -04:00
|
|
|
}
|
|
|
|
|
2014-06-17 15:21:28 -04:00
|
|
|
struct Baz;
|
|
|
|
|
|
|
|
impl Foo for Baz {}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let bar = Bar;
|
|
|
|
let baz = &Baz;
|
|
|
|
bar(baz);
|
|
|
|
}
|