mirror of
https://github.com/rust-lang/rust.git
synced 2024-12-04 20:54:13 +00:00
16 lines
336 B
Rust
16 lines
336 B
Rust
// 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(|| {
|
|
y.clone().into_iter();
|
|
//~^ ERROR cannot move out of `y`, a captured variable in an `Fn` closure
|
|
});
|
|
}
|