]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/augmented-assignments.rs
Rollup merge of #87440 - twetzel59:fix-barrier-no-op, r=yaahc
[rust.git] / src / test / ui / augmented-assignments.rs
index 2857ff2554a0c1f4e0c29ae8d7f37075896300c7..1b4ac6edcb0d5547ce40b2099cb97c3bb501c55e 100644 (file)
@@ -1,13 +1,3 @@
-// Copyright 2015 The Rust Project Developers. See the COPYRIGHT
-// file at the top-level directory of this distribution and at
-// http://rust-lang.org/COPYRIGHT.
-//
-// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
-// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
-// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
-// option. This file may not be copied, modified, or distributed
-// except according to those terms.
-
 use std::ops::AddAssign;
 
 struct Int(i32);
@@ -20,16 +10,18 @@ fn add_assign(&mut self, _: Int) {
 
 fn main() {
     let mut x = Int(1);
-    x   //~ error: use of moved value: `x`
-    //~^ value used here after move
+    x
+    //~^ NOTE borrow of `x` occurs here
     +=
-    x;  //~ value moved here
+    x;
+    //~^ ERROR cannot move out of `x` because it is borrowed
+    //~| move out of `x` occurs here
 
     let y = Int(2);
-    //~^ HELP make this binding mutable
+    //~^ HELP consider changing this to be mutable
     //~| SUGGESTION mut y
-    y   //~ error: cannot borrow immutable local variable `y` as mutable
-        //~| cannot borrow
+    y   //~ ERROR cannot borrow `y` as mutable, as it is not declared as mutable
+        //~| cannot borrow as mutable
     +=
     Int(1);
 }