summaryrefslogtreecommitdiffstats
path: root/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-18 02:49:50 +0000
commit9835e2ae736235810b4ea1c162ca5e65c547e770 (patch)
tree3fcebf40ed70e581d776a8a4c65923e8ec20e026 /tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
parentReleasing progress-linux version 1.70.0+dfsg2-1~progress7.99u1. (diff)
downloadrustc-9835e2ae736235810b4ea1c162ca5e65c547e770.tar.xz
rustc-9835e2ae736235810b4ea1c162ca5e65c547e770.zip
Merging upstream version 1.71.1+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr')
-rw-r--r--tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr85
1 files changed, 85 insertions, 0 deletions
diff --git a/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
new file mode 100644
index 000000000..25974e0d0
--- /dev/null
+++ b/tests/ui/borrowck/issue-109271-pass-self-into-closure.stderr
@@ -0,0 +1,85 @@
+error[E0502]: cannot borrow `v` as mutable because it is also borrowed as immutable
+ --> $DIR/issue-109271-pass-self-into-closure.rs:19:5
+ |
+LL | v.call(|(), this: &mut S| v.get());
+ | ^^----^------------------^-^^^^^^^
+ | | | | |
+ | | | | first borrow occurs due to use of `v` in closure
+ | | | | help: try using the closure argument: `this`
+ | | | immutable borrow occurs here
+ | | immutable borrow later used by call
+ | mutable borrow occurs here
+
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ --> $DIR/issue-109271-pass-self-into-closure.rs:21:5
+ |
+LL | v.call(|(), this: &mut S| v.set());
+ | ^^----^------------------^-^^^^^^^
+ | | | | |
+ | | | | first borrow occurs due to use of `v` in closure
+ | | | | help: try using the closure argument: `this`
+ | | | first mutable borrow occurs here
+ | | first borrow later used by call
+ | second mutable borrow occurs here
+
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ --> $DIR/issue-109271-pass-self-into-closure.rs:21:12
+ |
+LL | v.call(|(), this: &mut S| v.set());
+ | -------^^^^^^^^^^^^^^^^^^---------
+ | | | | |
+ | | | | second borrow occurs due to use of `v` in closure
+ | | | second mutable borrow occurs here
+ | | first borrow later used by call
+ | first mutable borrow occurs here
+
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ --> $DIR/issue-109271-pass-self-into-closure.rs:25:5
+ |
+LL | v.call(|(), this: &mut S| {
+ | ^ ---- ------------------ first mutable borrow occurs here
+ | | |
+ | _____| first borrow later used by call
+ | |
+LL | |
+LL | |
+LL | |
+LL | | _ = v;
+LL | | v.set();
+ | | - first borrow occurs due to use of `v` in closure
+... |
+LL | | _ = v.add(3);
+LL | | });
+ | |______^ second mutable borrow occurs here
+ |
+help: try using the closure argument
+ |
+LL ~ _ = this;
+LL ~ this.set();
+LL ~ this.get();
+LL ~ S::get(&this);
+ |
+
+error[E0499]: cannot borrow `v` as mutable more than once at a time
+ --> $DIR/issue-109271-pass-self-into-closure.rs:25:12
+ |
+LL | v.call(|(), this: &mut S| {
+ | - ---- ^^^^^^^^^^^^^^^^^^ second mutable borrow occurs here
+ | | |
+ | _____| first borrow later used by call
+ | |
+LL | |
+LL | |
+LL | |
+LL | | _ = v;
+LL | | v.set();
+ | | - second borrow occurs due to use of `v` in closure
+... |
+LL | | _ = v.add(3);
+LL | | });
+ | |______- first mutable borrow occurs here
+
+error: aborting due to 5 previous errors
+
+Some errors have detailed explanations: E0499, E0502.
+For more information about an error, try `rustc --explain E0499`.