about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--tests/ui/augmented-assignments.rs2
-rw-r--r--tests/ui/augmented-assignments.stderr9
2 files changed, 9 insertions, 2 deletions
diff --git a/tests/ui/augmented-assignments.rs b/tests/ui/augmented-assignments.rs
index bd2435a78bf..ca12395e432 100644
--- a/tests/ui/augmented-assignments.rs
+++ b/tests/ui/augmented-assignments.rs
@@ -1,5 +1,6 @@
 use std::ops::AddAssign;
 
+#[derive(Clone)]
 struct Int(i32);
 
 impl AddAssign for Int {
@@ -12,6 +13,7 @@ fn main() {
     let mut x = Int(1); //~ NOTE binding `x` declared here
     x
     //~^ NOTE borrow of `x` occurs here
+    //~| HELP consider cloning
     +=
     x;
     //~^ ERROR cannot move out of `x` because it is borrowed
diff --git a/tests/ui/augmented-assignments.stderr b/tests/ui/augmented-assignments.stderr
index d1096aea279..465b88fcd5b 100644
--- a/tests/ui/augmented-assignments.stderr
+++ b/tests/ui/augmented-assignments.stderr
@@ -1,5 +1,5 @@
 error[E0505]: cannot move out of `x` because it is borrowed
-  --> $DIR/augmented-assignments.rs:16:5
+  --> $DIR/augmented-assignments.rs:17:5
    |
 LL |     let mut x = Int(1);
    |         ----- binding `x` declared here
@@ -8,9 +8,14 @@ LL |     x
 ...
 LL |     x;
    |     ^ move out of `x` occurs here
+   |
+help: consider cloning the value if the performance cost is acceptable
+   |
+LL |     x.clone()
+   |      ++++++++
 
 error[E0596]: cannot borrow `y` as mutable, as it is not declared as mutable
-  --> $DIR/augmented-assignments.rs:23:5
+  --> $DIR/augmented-assignments.rs:25:5
    |
 LL |     y
    |     ^ cannot borrow as mutable