rust/src/test/run-pass/generic-temporary.rs
Brian Anderson 518dc52f85 Reformat
This changes the indexing syntax from .() to [], the vector syntax from ~[] to
[] and the extension syntax from #fmt() to #fmt[]
2011-08-20 11:04:00 -07:00

14 lines
266 B
Rust

fn mk() -> int { ret 1; }
fn chk(a: &int) { log a; assert (a == 1); }
fn apply<T>(produce: fn() -> T, consume: fn(&T)) { consume(produce()); }
fn main() {
let produce: fn() -> int = mk;
let consume: fn(&int) = chk;
apply::<int>(produce, consume);
}