/src/test/run-pass/autobind.rs
http://github.com/jruderman/rust · Rust · 9 lines · 7 code · 2 blank · 0 comment · 2 complexity · c3fddb21900a1d32c723e8fd27469c33 MD5 · raw file
- fn f<T: copy>(x: ~[T]) -> T { return x[0]; }
- fn g(act: fn(~[int]) -> int) -> int { return act(~[1, 2, 3]); }
- fn main() {
- assert (g(f) == 1);
- let f1: fn(~[~str]) -> ~str = f;
- assert (f1(~[~"x", ~"y", ~"z"]) == ~"x");
- }