rust/src/test/compile-fail/borrowck-loan-in-overloaded-op.rs

16 lines
286 B
Rust
Raw Normal View History

// xfail-test #3387
enum foo = ~uint;
impl foo: Add<foo, foo> {
pure fn add(f: foo) -> foo {
foo(~(**self + **f))
}
}
fn main() {
let x = foo(~3);
let _y = x + move x;
//~^ ERROR moving out of immutable local variable prohibited due to outstanding loan
}