Closed
Description
e.g. this variant of the test run-pass/issue-16671.rs
fn foo<F: FnOnce()>(_f: F) { }
fn main() {
let mut var = 0;
foo(move|| {
&mut var;
});
}
Causes this error:
error[E0596]: cannot borrow immutable item `var` as mutable (Mir)
--> ../src/test/run-pass/issue-16671.rs:18:9
|
18 | &mut var;
| ^^^^^^^^ cannot borrow as mutable
|
= note: Value not mutable causing this error: `_`
error: aborting due to previous error