1 use std::ops::AddAssign;
2
3 struct Int(i32);
4
5 impl AddAssign for Int {
add_assign(&mut self, _: Int)6 fn add_assign(&mut self, _: Int) {
7 unimplemented!()
8 }
9 }
10
main()11 fn main() {
12 let mut x = Int(1); //~ NOTE binding `x` declared here
13 x
14 //~^ NOTE borrow of `x` occurs here
15 +=
16 x;
17 //~^ ERROR cannot move out of `x` because it is borrowed
18 //~| move out of `x` occurs here
19
20 let y = Int(2);
21 //~^ HELP consider changing this to be mutable
22 //~| SUGGESTION mut
23 y //~ ERROR cannot borrow `y` as mutable, as it is not declared as mutable
24 //~| cannot borrow as mutable
25 +=
26 Int(1);
27 }
28