]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.fixed
Rollup merge of #106726 - cmorin6:fix-comment-typos, r=Nilstrieb
[rust.git] / tests / ui / borrowck / unboxed-closures-move-upvar-from-non-once-ref-closure.fixed
1 // run-rustfix
2 // Test that a by-ref `FnMut` closure gets an error when it tries to
3 // consume a value.
4
5 fn call<F>(f: F) where F : Fn() {
6     f();
7 }
8
9 fn main() {
10     let y = vec![format!("World")];
11     call(|| {
12         y.clone().into_iter();
13         //~^ ERROR cannot move out of `y`, a captured variable in an `Fn` closure
14     });
15 }