blob: dc875c3133d49a023ca156dde5b80dbbee435f59 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
|
// FIXME: Autobind doesn't work for bare functions currently
// because it would have to convert them to shared closures
// xfail-test
fn f<T>(x: [T]) -> T { ret x[0]; }
fn g(act: fn([int]) -> int) -> int { ret act([1, 2, 3]); }
fn main() {
assert (g(f) == 1);
let f1: fn([str]) -> str = f;
assert (f1(["x", "y", "z"]) == "x");
}
|