Closed
Description
For this code:
#![feature(conservative_impl_trait)]
use std::rc::Rc;
fn bar<R, F: FnMut() -> R>(_: F) -> R {
loop {}
}
fn foo() -> impl FnOnce() {
let a = Rc::new(());
bar(move || {
let _b = a.clone();
move || {
a.clone();
}
})
}
it yields the error:
error[E0507]: cannot move out of captured outer variable in an `FnMut` closure
--> foo.rs:12:9
|
12 | move || {
| ^^^^^^^ cannot move out of captured outer variable in an `FnMut` closure
error: aborting due to previous error
I recently found this error when I misspelled a captured variable as connnections
(should be connections
) and it'd be mega-helpful if the error message could mention which captured variable cannot be moved out of. (a span pointing at the variable would also work).