2018-08-30 07:18:55 -05:00
|
|
|
// run-pass
|
2015-03-22 15:13:15 -05:00
|
|
|
// pretty-expanded FIXME #23616
|
|
|
|
|
2014-12-07 09:22:06 -06: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 19:06:52 -05:00
|
|
|
fn thing(a: isize, b: isize) -> isize {
|
2014-12-07 09:22:06 -06:00
|
|
|
a + b
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2015-03-25 19:06:52 -05:00
|
|
|
let thing: fn(isize, isize) -> isize = thing; // coerce to fn type
|
2014-12-07 09:22:06 -06:00
|
|
|
bar(&thing);
|
|
|
|
}
|