fork/rust
git clone https://git.julia.blue/fork/rust
3bcad65fbf6
master
1error: captured variable cannot escape `FnMut` closure body 2 --> $DIR/do-not-suggest-adding-move-when-closure-is-already-marked-as-move.rs:6:9 3 | 4LL | let mut vec: Vec<i32> = Vec::new(); 5 | ------- variable defined here 6LL | let closure = move || { 7 | - inferred to be a `FnMut` closure 8LL | vec.clear(); 9 | --- variable captured here 10LL | let mut iter = vec.iter(); 11LL | move || { iter.next() } 12 | ^^^^^^^^^^^^^^^^^^^^^^^ returns a closure that contains a reference to a captured variable, which then escapes the closure body 13 | 14 = note: `FnMut` closures only have access to their captured variables while they are executing... 15 = note: ...therefore, they cannot allow references to captured variables to escape 16 17error: aborting due to previous error 18