298 lines
12 KiB
Plaintext
298 lines
12 KiB
Plaintext
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:26:9
|
|
|
|
|
LL | let ref mut a @ ref mut b = U;
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
|
|
|
|
|
LL | let ref mut a @ ref mut b = U;
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:33:9
|
|
|
|
|
LL | let ref mut a @ ref mut b = U;
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:36:9
|
|
|
|
|
LL | let ref mut a @ ref mut b = U;
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
|
|
|
|
|
LL | let ref mut a @ ref mut b = U;
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:44:9
|
|
|
|
|
LL | let ref mut a @ (
|
|
| ^^^^^^^^^ value is mutably borrowed by `a` here
|
|
LL |
|
|
LL | ref mut b,
|
|
| --------- value is mutably borrowed by `b` here
|
|
LL | [
|
|
LL | ref mut c,
|
|
| --------- value is mutably borrowed by `c` here
|
|
LL | ref mut d,
|
|
| --------- value is mutably borrowed by `d` here
|
|
LL | ref e,
|
|
| ----- value is borrowed by `e` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:54:9
|
|
|
|
|
LL | let ref mut a @ (
|
|
| ^^^^^^^^^ value is mutably borrowed by `a` here
|
|
LL |
|
|
LL | ref mut b,
|
|
| --------- value is mutably borrowed by `b` here
|
|
LL | [
|
|
LL | ref mut c,
|
|
| --------- value is mutably borrowed by `c` here
|
|
LL | ref mut d,
|
|
| --------- value is mutably borrowed by `d` here
|
|
LL | ref e,
|
|
| ----- value is borrowed by `e` here
|
|
|
|
error: borrow of moved value
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:64:9
|
|
|
|
|
LL | let a @ (ref mut b, ref mut c) = (U, U);
|
|
| ^ --------- --------- value borrowed here after move
|
|
| | |
|
|
| | 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
|
|
|
|
|
LL | let a @ (b, [c, d]) = &mut val; // Same as ^--
|
|
| ^ - - - value borrowed here after move
|
|
| | | |
|
|
| | | value borrowed here after move
|
|
| | 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
|
|
|
|
|
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
|
|
|
|
|
LL | let a @ &mut (ref mut b, ref mut c) = &mut (U, U);
|
|
| ^ --------- --------- value borrowed here after move
|
|
| | |
|
|
| | 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
|
|
|
|
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:76:37
|
|
|
|
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:9
|
|
|
|
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:37
|
|
|
|
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:91:9
|
|
|
|
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:91:37
|
|
|
|
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:9
|
|
|
|
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:101:37
|
|
|
|
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error[E0499]: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:29:9
|
|
|
|
|
LL | let ref mut a @ ref mut b = U;
|
|
| ^^^^^^^^^ --------- first mutable borrow occurs here
|
|
| |
|
|
| second mutable borrow occurs here
|
|
...
|
|
LL | drop(b);
|
|
| - first borrow later used here
|
|
|
|
error[E0499]: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:39:9
|
|
|
|
|
LL | let ref mut a @ ref mut b = U;
|
|
| ^^^^^^^^^ --------- first mutable borrow occurs here
|
|
| |
|
|
| second mutable borrow occurs here
|
|
...
|
|
LL | *b = U;
|
|
| ------ first borrow later used here
|
|
|
|
error[E0499]: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:9
|
|
|
|
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|
| ^^^^^^^^^ --------- first mutable borrow occurs here
|
|
| |
|
|
| second mutable borrow occurs here
|
|
...
|
|
LL | *b = U;
|
|
| ------ first borrow later used here
|
|
|
|
error[E0499]: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:82:37
|
|
|
|
|
LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
|
|
| ^^^^^^^^^ --------- first mutable borrow occurs here
|
|
| |
|
|
| second mutable borrow occurs here
|
|
...
|
|
LL | *b = U;
|
|
| ------ first borrow later used here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:8:11
|
|
|
|
|
LL | fn f1(ref mut a @ ref mut b: U) {}
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:10:11
|
|
|
|
|
LL | fn f2(ref mut a @ ref mut b: U) {}
|
|
| ^^^^^^^^^ --------- value is mutably borrowed by `b` here
|
|
| |
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:13:9
|
|
|
|
|
LL | ref mut a @ [
|
|
| ^^^^^^^^^ value is mutably borrowed by `a` here
|
|
LL |
|
|
LL | [ref b @ .., _],
|
|
| ----- value is borrowed by `b` here
|
|
LL | [_, ref mut mid @ ..],
|
|
| ----------- value is mutably borrowed by `mid` here
|
|
|
|
error: cannot borrow value as mutable more than once at a time
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:22
|
|
|
|
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
|
|
| ^^^^^^^^^ --------- - value is moved into `c` here
|
|
| | |
|
|
| | value is mutably borrowed by `b` here
|
|
| value is mutably borrowed by `a` here
|
|
|
|
error: cannot move out of value because it is borrowed
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
|
|
|
|
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
|
|
| ^^^^^^^^^ - value is moved into `c` here
|
|
| |
|
|
| value is mutably borrowed by `b` here
|
|
|
|
error[E0382]: borrow of moved value
|
|
--> $DIR/borrowck-pat-ref-mut-twice.rs:21:34
|
|
|
|
|
LL | fn f4_also_moved(ref mut a @ ref mut b @ c: U) {}
|
|
| --------- ^^^^^^^^^ - value moved here
|
|
| | |
|
|
| | value borrowed here after move
|
|
| move occurs because value has type `U`, which does not implement the `Copy` trait
|
|
|
|
error: aborting due to 29 previous errors
|
|
|
|
Some errors have detailed explanations: E0382, E0499.
|
|
For more information about an error, try `rustc --explain E0382`.
|