]> git.lizzy.rs Git - rust.git/blob - tests/ui/borrowck/unboxed-closures-move-upvar-from-non-once-ref-closure.rs
Rollup merge of #107306 - compiler-errors:correct-sugg-for-closure-arg-needs-borrow...
[rust.git] / tests / ui / borrowck / unboxed-closures-move-upvar-from-non-once-ref-closure.rs
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.into_iter();
13         //~^ ERROR cannot move out of `y`, a captured variable in an `Fn` closure
14     });
15 }