rust/tests/ui/borrowck/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs

9 lines
239 B
Rust
Raw Normal View History

fn main() {
let mut vec: Vec<i32> = Vec::new();
let closure = move || {
vec.clear();
let mut iter = vec.iter();
move || { iter.next() } //~ ERROR captured variable cannot escape `FnMut` closure bod
};
}