2018-08-08 12:28:26 +00:00
|
|
|
error[E0594]: cannot assign to `counter`, as it is a captured variable in a `Fn` closure
|
2019-04-22 07:40:08 +00:00
|
|
|
--> $DIR/unboxed-closures-mutated-upvar-from-fn-closure.rs:11:9
|
2018-08-08 12:28:26 +00:00
|
|
|
|
|
2022-06-27 05:45:35 +00:00
|
|
|
LL | fn call<F>(f: F) where F : Fn() {
|
|
|
|
| - change this to accept `FnMut` instead of `Fn`
|
2020-02-04 00:08:45 +00:00
|
|
|
...
|
2022-06-27 05:45:35 +00:00
|
|
|
LL | call(|| {
|
2022-06-27 05:33:19 +00:00
|
|
|
| ---- -- in this closure
|
|
|
|
| |
|
|
|
|
| expects `Fn` instead of `FnMut`
|
2022-06-27 05:45:35 +00:00
|
|
|
LL | counter += 1;
|
|
|
|
| ^^^^^^^^^^^^ cannot assign
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2023-11-21 15:44:16 +00:00
|
|
|
error: aborting due to 1 previous error
|
2018-08-08 12:28:26 +00:00
|
|
|
|
2019-11-06 12:58:44 +00:00
|
|
|
For more information about this error, try `rustc --explain E0594`.
|