rust/src/test/compile-fail/no-capture-arc.rs

20 lines
340 B
Rust
Raw Normal View History

// error-pattern: copying a noncopyable value
extern mod std;
2012-09-05 14:32:05 -05:00
use std::arc;
use comm::*;
fn main() {
let v = ~[1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
2012-08-29 16:45:25 -05:00
let arc_v = arc::ARC(v);
do task::spawn() {
let v = *arc::get(&arc_v);
assert v[3] == 4;
};
assert (*arc::get(&arc_v))[2] == 3;
log(info, arc_v);
}