rust/src/test/compile-fail/pinned-deep-copy.rs
2012-06-01 20:40:35 -07:00

18 lines
319 B
Rust

// error-pattern: copying a noncopyable value
class r {
let i: @mut int;
new(i: @mut int) { self.i = i; }
drop { *(self.i) = *(self.i) + 1; }
}
fn main() {
let i = @mut 0;
{
// Can't do this copy
let x = ~~~{y: r(i)};
let z = x;
log(debug, x);
}
log(error, *i);
}