rust/src/test/run-pass/resource-destruct.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
258 B
Rust

resource shrinky_pointer(i: @mutable int) { *i -= 1; }
fn look_at(pt: shrinky_pointer) -> int { ret **pt; }
fn main() {
let my_total = @mutable 10;
{ let pt <- shrinky_pointer(my_total); assert (look_at(pt) == 10); }
assert (*my_total == 9);
}