blob: eea15eae879e66bb678de14a12b6171d7c967937 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
use std::ops::AddAssign;
struct Int(i32);
impl AddAssign for Int {
fn add_assign(&mut self, _: Int) {
unimplemented!()
}
}
fn main() {
let mut x = Int(1);
x //~ error: use of moved value: `x`
//~^ value used here after move
+=
x; //~ value moved here
let y = Int(2);
//~^ HELP make this binding mutable
//~| SUGGESTION mut y
y //~ error: cannot borrow immutable local variable `y` as mutable
//~| cannot borrow
+=
Int(1);
}
|