diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-17 12:02:58 +0000 |
commit | 698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch) | |
tree | 173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/nll/closures-in-loops.stderr | |
parent | Initial commit. (diff) | |
download | rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.tar.xz rustc-698f8c2f01ea549d77d7dc3338a12e04c11057b9.zip |
Adding upstream version 1.64.0+dfsg1.upstream/1.64.0+dfsg1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/test/ui/nll/closures-in-loops.stderr')
-rw-r--r-- | src/test/ui/nll/closures-in-loops.stderr | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/src/test/ui/nll/closures-in-loops.stderr b/src/test/ui/nll/closures-in-loops.stderr new file mode 100644 index 000000000..2be0460df --- /dev/null +++ b/src/test/ui/nll/closures-in-loops.stderr @@ -0,0 +1,31 @@ +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 + +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 + +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`. |