/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

  1. fn f<T: copy>(x: ~[T]) -> T { return x[0]; }
  2. fn g(act: fn(~[int]) -> int) -> int { return act(~[1, 2, 3]); }
  3. fn main() {
  4. assert (g(f) == 1);
  5. let f1: fn(~[~str]) -> ~str = f;
  6. assert (f1(~[~"x", ~"y", ~"z"]) == ~"x");
  7. }