rust/src/test/run-pass/resource-generic.rs
Marijn Haverbeke fc6b7c8b38 Reformat for new mode syntax, step 1
Long lines were fixed in a very crude way, as I'll be following up
with another reformat in a bit.
2011-09-12 12:04:14 +02:00

10 lines
231 B
Rust

resource finish<T>(arg: {val: T, fin: fn(T)}) { arg.fin(arg.val); }
fn main() {
let box = @mutable 10;
fn dec_box(i: @mutable int) { *i -= 1; }
{ let i <- finish({val: box, fin: dec_box}); }
assert (*box == 9);
}