]> git.lizzy.rs Git - rust.git/blob - src/test/ui/augmented-assignments.rs
Auto merge of #56079 - mark-i-m:patch-1, r=nikomatsakis
[rust.git] / src / test / ui / augmented-assignments.rs
1 use std::ops::AddAssign;
2
3 struct Int(i32);
4
5 impl AddAssign for Int {
6     fn add_assign(&mut self, _: Int) {
7         unimplemented!()
8     }
9 }
10
11 fn main() {
12     let mut x = Int(1);
13     x   //~ error: use of moved value: `x`
14     //~^ value used here after move
15     +=
16     x;  //~ value moved here
17
18     let y = Int(2);
19     //~^ HELP make this binding mutable
20     //~| SUGGESTION mut y
21     y   //~ error: cannot borrow immutable local variable `y` as mutable
22         //~| cannot borrow
23     +=
24     Int(1);
25 }