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