2014-06-17 14:21:28 -05:00
|
|
|
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
|
|
|
|
// file at the top-level directory of this distribution and at
|
|
|
|
// http://rust-lang.org/COPYRIGHT.
|
|
|
|
//
|
|
|
|
// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
|
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
|
|
|
|
// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
|
|
|
|
// option. This file may not be copied, modified, or distributed
|
|
|
|
// except according to those terms.
|
|
|
|
|
2015-03-22 15:13:15 -05:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2015-12-02 19:31:49 -06:00
|
|
|
#![feature(fn_traits, unboxed_closures)]
|
2014-06-17 14:21:28 -05:00
|
|
|
|
2015-02-12 09:29:52 -06:00
|
|
|
trait Foo { fn dummy(&self) { }}
|
2014-06-17 14:21:28 -05:00
|
|
|
|
|
|
|
struct Bar;
|
|
|
|
|
2015-01-12 09:27:25 -06:00
|
|
|
impl<'a> std::ops::Fn<(&'a (Foo+'a),)> for Bar {
|
2014-05-29 00:26:56 -05:00
|
|
|
extern "rust-call" fn call(&self, _: (&'a Foo,)) {}
|
2014-06-17 14:21:28 -05:00
|
|
|
}
|
|
|
|
|
2015-03-11 09:08:33 -05:00
|
|
|
impl<'a> std::ops::FnMut<(&'a (Foo+'a),)> for Bar {
|
|
|
|
extern "rust-call" fn call_mut(&mut self, a: (&'a Foo,)) { self.call(a) }
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<'a> std::ops::FnOnce<(&'a (Foo+'a),)> for Bar {
|
|
|
|
type Output = ();
|
|
|
|
extern "rust-call" fn call_once(self, a: (&'a Foo,)) { self.call(a) }
|
|
|
|
}
|
|
|
|
|
2014-06-17 14:21:28 -05:00
|
|
|
struct Baz;
|
|
|
|
|
|
|
|
impl Foo for Baz {}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
let bar = Bar;
|
|
|
|
let baz = &Baz;
|
|
|
|
bar(baz);
|
|
|
|
}
|