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

13 lines
236 B
Rust
Raw Normal View History

extern mod std;
2012-09-05 14:32:05 -05:00
use sys::refcount;
2011-10-10 17:19:34 -05:00
fn main() unsafe {
let i = ~@1;
let j = ~@2;
let rc1 = refcount(*i);
2012-12-05 18:51:32 -06:00
let j = copy i;
let rc2 = refcount(*i);
2012-08-22 19:24:52 -05:00
error!("rc1: %u rc2: %u", rc1, rc2);
assert rc1 + 1u == rc2;
2012-12-05 18:51:32 -06:00
}