]> git.proxmox.com Git - rustc.git/blob - tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
New upstream version 1.68.2+dfsg1
[rustc.git] / tests / ui / borrowck / unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
1 error[E0507]: cannot move out of `y`, a captured variable in an `Fn` closure
2 --> $DIR/unboxed-closures-move-upvar-from-non-once-ref-closure.rs:12:9
3 |
4 LL | let y = vec![format!("World")];
5 | - captured outer variable
6 LL | call(|| {
7 | -- captured by this `Fn` closure
8 LL | y.into_iter();
9 | ^ ----------- `y` moved due to this method call
10 | |
11 | move occurs because `y` has type `Vec<String>`, which does not implement the `Copy` trait
12 |
13 note: `into_iter` takes ownership of the receiver `self`, which moves `y`
14 --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
15 help: you can `clone` the value and consume it, but this might not be your desired behavior
16 |
17 LL | y.clone().into_iter();
18 | ++++++++
19
20 error: aborting due to previous error
21
22 For more information about this error, try `rustc --explain E0507`.