rust/src/test/run-pass/unique-copy-box.rs

12 lines
226 B
Rust
Raw Normal View History

use std;
import sys::refcount;
2011-10-10 17:19:34 -05:00
fn main() unsafe {
let i = ~@1;
let j = ~@2;
let rc1 = refcount(*i);
let j = i;
let rc2 = refcount(*i);
error!{"rc1: %u rc2: %u", rc1, rc2};
assert rc1 + 1u == rc2;
}