rust/src/test/run-pass/obj-dtor-2.rs

9 lines
168 B
Rust

obj foo(@mutable int x) {drop { log "running dtor"; *x = *x + 1; } }
fn main() {
auto mbox = @mutable 10;
{ auto x = foo(mbox); }
assert (*mbox == 11);
}