rust/src/test/run-pass/autobind.rs

10 lines
215 B
Rust
Raw Normal View History

fn f<T: copy>(x: [T]) -> T { ret x[0]; }
fn g(act: fn([int]) -> int) -> int { ret act([1, 2, 3]); }
fn main() {
2011-07-27 07:19:39 -05:00
assert (g(f) == 1);
let f1: fn([str]) -> str = f;
assert (f1(["x", "y", "z"]) == "x");
}