summaryrefslogtreecommitdiffstats
path: root/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:02:58 +0000
commit698f8c2f01ea549d77d7dc3338a12e04c11057b9 (patch)
tree173a775858bd501c378080a10dca74132f05bc50 /src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
parentInitial commit. (diff)
downloadrustc-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/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr')
-rw-r--r--src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
new file mode 100644
index 000000000..0c151b097
--- /dev/null
+++ b/src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
@@ -0,0 +1,21 @@
+error[E0507]: cannot move out of `y`, a captured variable in an `Fn` closure
+ --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:11:9
+ |
+LL | let y = vec![format!("World")];
+ | - captured outer variable
+LL | call(|| {
+ | -- captured by this `Fn` closure
+LL | y.into_iter();
+ | ^ ----------- `y` moved due to this method call
+ | |
+ | move occurs because `y` has type `Vec<String>`, which does not implement the `Copy` trait
+ |
+note: this function takes ownership of the receiver `self`, which moves `y`
+ --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
+ |
+LL | fn into_iter(self) -> Self::IntoIter;
+ | ^^^^
+
+error: aborting due to previous error
+
+For more information about this error, try `rustc --explain E0507`.