2015-01-24 16:25:07 -06:00
|
|
|
// 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() {
|
2017-12-10 14:29:24 -06:00
|
|
|
let y = vec![format!("World")];
|
2015-01-24 16:25:07 -06:00
|
|
|
call(|| {
|
|
|
|
y.into_iter();
|
2019-05-05 06:02:32 -05:00
|
|
|
//~^ ERROR cannot move out of `y`, a captured variable in an `Fn` closure
|
2015-01-24 16:25:07 -06:00
|
|
|
});
|
|
|
|
}
|