mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +00:00
24 lines
349 B
Rust
24 lines
349 B
Rust
//@ run-pass
|
|
//@ pretty-expanded FIXME #23616
|
|
|
|
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()
|
|
}
|
|
|
|
fn thing(a: isize, b: isize) -> isize {
|
|
a + b
|
|
}
|
|
|
|
fn main() {
|
|
let thing: fn(isize, isize) -> isize = thing; // coerce to fn type
|
|
bar(&thing);
|
|
}
|