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