PageRenderTime 35ms CodeModel.GetById 27ms app.highlight 4ms RepoModel.GetById 2ms app.codeStats 0ms

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