]> git.lizzy.rs Git - rust.git/blob - src/test/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.stderr
Rollup merge of #102500 - compiler-errors:parse-sess-cleanup, r=cjgillot
[rust.git] / src / test / 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:11: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: this function takes ownership of the receiver `self`, which moves `y`
14   --> $SRC_DIR/core/src/iter/traits/collect.rs:LL:COL
15    |
16 LL |     fn into_iter(self) -> Self::IntoIter;
17    |                  ^^^^
18
19 error: aborting due to previous error
20
21 For more information about this error, try `rustc --explain E0507`.