summaryrefslogtreecommitdiffstats
path: root/tests/ui/nll/closures-in-loops.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:13 +0000
commit218caa410aa38c29984be31a5229b9fa717560ee (patch)
treec54bd55eeb6e4c508940a30e94c0032fbd45d677 /tests/ui/nll/closures-in-loops.stderr
parentReleasing progress-linux version 1.67.1+dfsg1-1~progress7.99u1. (diff)
downloadrustc-218caa410aa38c29984be31a5229b9fa717560ee.tar.xz
rustc-218caa410aa38c29984be31a5229b9fa717560ee.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/ui/nll/closures-in-loops.stderr')
-rw-r--r--tests/ui/nll/closures-in-loops.stderr35
1 files changed, 35 insertions, 0 deletions
diff --git a/tests/ui/nll/closures-in-loops.stderr b/tests/ui/nll/closures-in-loops.stderr
new file mode 100644
index 000000000..1c1a31d35
--- /dev/null
+++ b/tests/ui/nll/closures-in-loops.stderr
@@ -0,0 +1,35 @@
+error[E0382]: use of moved value: `x`
+ --> $DIR/closures-in-loops.rs:6:9
+ |
+LL | fn repreated_move(x: String) {
+ | - move occurs because `x` has type `String`, which does not implement the `Copy` trait
+LL | for i in 0..10 {
+LL | || x;
+ | ^^ - use occurs due to use in closure
+ | |
+ | value moved into closure here, in previous iteration of loop
+
+error[E0499]: cannot borrow `x` as mutable more than once at a time
+ --> $DIR/closures-in-loops.rs:13:16
+ |
+LL | v.push(|| x = String::new());
+ | -------^^-------------------
+ | | | |
+ | | | borrows occur due to use of `x` in closure
+ | | `x` was mutably borrowed here in the previous iteration of the loop
+ | first borrow used here, in later iteration of loop
+
+error[E0524]: two closures require unique access to `x` at the same time
+ --> $DIR/closures-in-loops.rs:20:16
+ |
+LL | v.push(|| *x = String::new());
+ | -------^^--------------------
+ | | | |
+ | | | borrows occur due to use of `x` in closure
+ | | closures are constructed here in different iterations of loop
+ | first borrow used here, in later iteration of loop
+
+error: aborting due to 3 previous errors
+
+Some errors have detailed explanations: E0382, E0499, E0524.
+For more information about an error, try `rustc --explain E0382`.