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