2020-02-03 18:08:45 -06:00
|
|
|
pub fn bar<F: Fn()>(_f: F) {} //~ NOTE change this to accept `FnMut` instead of `Fn`
|
2018-01-15 15:27:58 -06:00
|
|
|
|
|
|
|
pub fn foo() {
|
|
|
|
let mut x = 0;
|
|
|
|
bar(move || x = 1);
|
2019-04-22 02:40:08 -05:00
|
|
|
//~^ ERROR cannot assign to `x`, as it is a captured variable in a `Fn` closure
|
|
|
|
//~| NOTE cannot assign
|
2020-02-03 18:08:45 -06:00
|
|
|
//~| NOTE expects `Fn` instead of `FnMut`
|
2022-06-27 00:33:19 -05:00
|
|
|
//~| NOTE in this closure
|
2018-01-15 15:27:58 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {}
|