blob: 3b4f7c8465cfad3c5b91aefdac42f0c847043d10 [file] [log] [blame] [edit]
//@ run-rustfix
// Test that a by-ref `FnMut` closure gets an error when it tries to
// consume a value.
fn call<F>(f: F) where F : Fn() {
f();
}
fn main() {
let y = vec![format!("World")];
call(|| {
<Vec<String> as Clone>::clone(&y.clone()).into_iter();
//~^ ERROR cannot move out of `y`, a captured variable in an `Fn` closure
});
}