3397fa4701
Issue #1076
21 lines
350 B
Rust
21 lines
350 B
Rust
// error-pattern: cannot copy pinned type 'a
|
|
|
|
resource r(i: @mutable int) {
|
|
*i = *i + 1;
|
|
}
|
|
|
|
fn movearg<pin T>(i: T) {
|
|
// Implicit copy to mutate reference i
|
|
let j <- i;
|
|
}
|
|
|
|
fn main() {
|
|
let i = @mutable 0;
|
|
{
|
|
let j <- r(i);
|
|
movearg(j);
|
|
}
|
|
log_err *i;
|
|
// nooooooo. destructor ran twice
|
|
assert *i == 2;
|
|
} |