18 lines
319 B
Rust
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);
|
|
} |