]> git.lizzy.rs Git - rust.git/blobdiff - src/test/ui/binop/binop-move-semantics.stderr
Update tests for changes to cannot move errors
[rust.git] / src / test / ui / binop / binop-move-semantics.stderr
index acc2620681b6a0b843a6e936f35230b1cc9b2969..897607dc2d8d52b59457c21d528386af02670093 100644 (file)
@@ -1,80 +1,95 @@
 error[E0382]: use of moved value: `x`
   --> $DIR/binop-move-semantics.rs:8:5
    |
+LL | fn double_move<T: Add<Output=()>>(x: T) {
+   |                -                  - move occurs because `x` has type `T`, which does not implement the `Copy` trait
+   |                |
+   |                consider adding a `Copy` constraint to this type argument
 LL |     x
    |     - value moved here
 LL |     +
 LL |     x;
    |     ^ value used here after move
-   |
-   = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
 
-error[E0382]: use of moved value: `x`
+error[E0382]: borrow of moved value: `x`
   --> $DIR/binop-move-semantics.rs:14:5
    |
+LL | fn move_then_borrow<T: Add<Output=()> + Clone>(x: T) {
+   |                     -                          - move occurs because `x` has type `T`, which does not implement the `Copy` trait
+   |                     |
+   |                     consider adding a `Copy` constraint to this type argument
 LL |     x
    |     - value moved here
 LL |     +
 LL |     x.clone();
-   |     ^ value used here after move
-   |
-   = note: move occurs because `x` has type `T`, which does not implement the `Copy` trait
+   |     ^ value borrowed here after move
 
 error[E0505]: cannot move out of `x` because it is borrowed
   --> $DIR/binop-move-semantics.rs:21:5
    |
 LL |     let m = &x;
-   |              - borrow of `x` occurs here
+   |             -- borrow of `x` occurs here
 ...
 LL |     x
    |     ^ move out of `x` occurs here
+...
+LL |     use_mut(n); use_imm(m);
+   |                         - borrow later used here
 
 error[E0505]: cannot move out of `y` because it is borrowed
   --> $DIR/binop-move-semantics.rs:23:5
    |
 LL |     let n = &mut y;
-   |                  - borrow of `y` occurs here
+   |             ------ borrow of `y` occurs here
 ...
 LL |     y;
    |     ^ move out of `y` occurs here
+LL |     use_mut(n); use_imm(m);
+   |             - borrow later used here
 
-error[E0507]: cannot move out of borrowed content
+error[E0507]: cannot move out of `*m` which is behind a mutable reference
   --> $DIR/binop-move-semantics.rs:30:5
    |
 LL |     *m
-   |     ^^ cannot move out of borrowed content
+   |     ^^ move occurs because `*m` has type `T`, which does not implement the `Copy` trait
 
-error[E0507]: cannot move out of borrowed content
+error[E0507]: cannot move out of `*n` which is behind a shared reference
   --> $DIR/binop-move-semantics.rs:32:5
    |
 LL |     *n;
-   |     ^^ cannot move out of borrowed content
+   |     ^^ move occurs because `*n` has type `T`, which does not implement the `Copy` trait
 
 error[E0502]: cannot borrow `f` as immutable because it is also borrowed as mutable
-  --> $DIR/binop-move-semantics.rs:54:6
+  --> $DIR/binop-move-semantics.rs:54:5
    |
-LL |     &mut f
-   |          - mutable borrow occurs here
-LL |     +
-LL |     &f;
-   |      ^
-   |      |
-   |      immutable borrow occurs here
-   |      mutable borrow ends here
+LL |       &mut f
+   |       ------
+   |       |
+   |  _____mutable borrow occurs here
+   | |
+LL | |     +
+LL | |     &f;
+   | |     ^-
+   | |_____||
+   |       |mutable borrow later used here
+   |       immutable borrow occurs here
 
 error[E0502]: cannot borrow `f` as mutable because it is also borrowed as immutable
-  --> $DIR/binop-move-semantics.rs:62:10
+  --> $DIR/binop-move-semantics.rs:62:5
    |
-LL |     &f
-   |      - immutable borrow occurs here
-LL |     +
-LL |     &mut f;
-   |          ^
-   |          |
-   |          mutable borrow occurs here
-   |          immutable borrow ends here
+LL |       &f
+   |       --
+   |       |
+   |  _____immutable borrow occurs here
+   | |
+LL | |     +
+LL | |     &mut f;
+   | |     ^^^^^-
+   | |_____|____|
+   |       |    immutable borrow later used here
+   |       mutable borrow occurs here
 
 error: aborting due to 8 previous errors
 
-Some errors occurred: E0382, E0502, E0505, E0507.
+Some errors have detailed explanations: E0382, E0502, E0505, E0507.
 For more information about an error, try `rustc --explain E0382`.