2018-08-30 14:18:55 +02:00
|
|
|
// run-pass
|
2015-03-22 13:13:15 -07:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2014-12-07 15:22:06 +00:00
|
|
|
trait MyTrait {
|
|
|
|
fn foo(&self);
|
|
|
|
}
|
|
|
|
|
|
|
|
impl<A, B, C> MyTrait for fn(A, B) -> C {
|
|
|
|
fn foo(&self) {}
|
|
|
|
}
|
|
|
|
|
|
|
|
fn bar<T: MyTrait>(t: &T) {
|
|
|
|
t.foo()
|
|
|
|
}
|
|
|
|
|
2015-03-25 17:06:52 -07:00
|
|
|
fn thing(a: isize, b: isize) -> isize {
|
2014-12-07 15:22:06 +00:00
|
|
|
a + b
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2015-03-25 17:06:52 -07:00
|
|
|
let thing: fn(isize, isize) -> isize = thing; // coerce to fn type
|
2014-12-07 15:22:06 +00:00
|
|
|
bar(&thing);
|
|
|
|
}
|