summaryrefslogtreecommitdiffstats
path: root/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr')
-rw-r--r--tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr359
1 files changed, 359 insertions, 0 deletions
diff --git a/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr
new file mode 100644
index 000000000..ad4ce7952
--- /dev/null
+++ b/tests/ui/pattern/bindings-after-at/borrowck-pat-ref-mut-twice.stderr
@@ -0,0 +1,359 @@
+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;
+ | ---------^^^---------
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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;
+ | ---------^^^---------
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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;
+ | ---------^^^---------
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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;
+ | ---------^^^---------
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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;
+ | ---------^^^---------
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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 @ (
+ | ^--------
+ | |
+ | _________first mutable borrow, by `a`, occurs here
+ | |
+LL | |
+LL | | ref mut b,
+ | | --------- another mutable borrow, by `b`, occurs here
+LL | | [
+LL | | ref mut c,
+ | | --------- another mutable borrow, by `c`, occurs here
+LL | | ref mut d,
+ | | --------- another mutable borrow, by `d`, occurs here
+LL | | ref e,
+ | | ----- also borrowed as immutable, by `e`, here
+LL | | ]
+LL | | ) = (U, [U, U, U]);
+ | |_____^
+
+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 @ (
+ | ^--------
+ | |
+ | _________first mutable borrow, by `a`, occurs here
+ | |
+LL | |
+LL | | ref mut b,
+ | | --------- another mutable borrow, by `b`, occurs here
+LL | | [
+LL | | ref mut c,
+ | | --------- another mutable borrow, by `c`, occurs here
+LL | | ref mut d,
+ | | --------- another mutable borrow, by `d`, occurs here
+LL | | ref e,
+ | | ----- also borrowed as immutable, by `e`, here
+LL | | ]
+LL | | ) = (u(), [u(), u(), u()]);
+ | |_________^
+
+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) => {
+ | ---------^^^^^^---------^
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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) => {
+ | ---------^^^^^^^---------^
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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) => {
+ | ---------^^^^^^---------^
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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) => {
+ | ---------^^^^^^^---------^
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:89:9
+ |
+LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
+ | ---------^^^^^^---------^
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs here
+
+error: cannot borrow value as mutable more than once at a time
+ --> $DIR/borrowck-pat-ref-mut-twice.rs:89:37
+ |
+LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
+ | ---------^^^^^^^---------^
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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) => {
+ | ---------^^^^^^---------^
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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) => {
+ | ---------^^^^^^^---------^
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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) {}
+ | ---------^^^---------
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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) {}
+ | ---------^^^---------
+ | | |
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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 @ [
+ | ^--------
+ | |
+ | _________first mutable borrow, by `a`, occurs here
+ | |
+LL | |
+LL | | [ref b @ .., _],
+ | | ---------- also borrowed as immutable, by `b`, here
+LL | | [_, ref mut mid @ ..],
+ | | ---------------- another mutable borrow, by `mid`, occurs here
+LL | | ..,
+LL | | [..],
+LL | | ] : [[U; 4]; 5]
+ | |_________^
+
+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) {}
+ | ---------^^^-------------
+ | | | |
+ | | | also moved into `c` here
+ | | another mutable borrow, by `b`, occurs here
+ | first mutable borrow, by `a`, occurs 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 moved into `c` here
+ | value borrowed, by `b`, 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:89:24
+ |
+LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
+ | --------- ^^^^^^^^^ second mutable borrow occurs here
+ | |
+ | first mutable borrow occurs here
+...
+LL | *a = Err(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:89:53
+ |
+LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
+ | --------- ^^^^^^^^^ second mutable borrow occurs here
+ | |
+ | first mutable borrow occurs here
+...
+LL | *a = Err(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:101:24
+ |
+LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
+ | --------- ^^^^^^^^^ second mutable borrow occurs here
+ | |
+ | first mutable borrow occurs here
+...
+LL | drop(a);
+ | - 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:101:53
+ |
+LL | ref mut a @ Ok(ref mut b) | ref mut a @ Err(ref mut b) => {
+ | --------- ^^^^^^^^^ second mutable borrow occurs here
+ | |
+ | first mutable borrow occurs here
+...
+LL | drop(a);
+ | - first borrow later used 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 31 previous errors
+
+Some errors have detailed explanations: E0382, E0499.
+For more information about an error, try `rustc --explain E0382`.