]> git.proxmox.com Git - rustc.git/blobdiff - src/test/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr
New upstream version 1.67.1+dfsg1
[rustc.git] / src / test / ui / pattern / bindings-after-at / borrowck-pat-ref-mut-twice.stderr
index 384a57b2ee092a37fcd0333d9d07888e2bdea156..ad4ce7952ca7494b065b86b9f62107b24655d5ea 100644 (file)
@@ -97,6 +97,11 @@ LL |     let a @ (ref mut b, ref mut c) = (U, U);
    |         |    value borrowed here after move
    |         value moved into `a` here
    |         move occurs because `a` has type `(U, U)` which does not implement the `Copy` trait
+   |
+help: borrow this binding in the pattern to avoid moving the value
+   |
+LL |     let ref a @ (ref mut b, ref mut c) = (U, U);
+   |         +++
 
 error: borrow of moved value
   --> $DIR/borrowck-pat-ref-mut-twice.rs:67:9
@@ -109,6 +114,11 @@ LL |     let a @ (b, [c, d]) = &mut val; // Same as ^--
    |         |    value borrowed here after move
    |         value moved into `a` here
    |         move occurs because `a` has type `&mut (U, [U; 2])` which does not implement the `Copy` trait
+   |
+help: borrow this binding in the pattern to avoid moving the value
+   |
+LL |     let ref a @ (b, [c, d]) = &mut val; // Same as ^--
+   |         +++
 
 error: borrow of moved value
   --> $DIR/borrowck-pat-ref-mut-twice.rs:70:9
@@ -119,6 +129,11 @@ LL |     let a @ &mut ref mut b = &mut U;
    |         |        value borrowed here after move
    |         value moved into `a` here
    |         move occurs because `a` has type `&mut U` which does not implement the `Copy` trait
+   |
+help: borrow this binding in the pattern to avoid moving the value
+   |
+LL |     let ref a @ &mut ref mut b = &mut U;
+   |         +++
 
 error: borrow of moved value
   --> $DIR/borrowck-pat-ref-mut-twice.rs:72:9
@@ -130,6 +145,11 @@ LL |     let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
    |         |         value borrowed here after move
    |         value moved into `a` here
    |         move occurs because `a` has type `&mut (U, U)` which does not implement the `Copy` trait
+   |
+help: borrow this binding in the pattern to avoid moving the value
+   |
+LL |     let ref a @ &mut (ref mut b, ref mut c) = &mut (U, U);
+   |         +++
 
 error: cannot borrow value as mutable more than once at a time
   --> $DIR/borrowck-pat-ref-mut-twice.rs:76:9