2019-04-22 02:40:08 -05:00
|
|
|
error[E0594]: cannot assign to `n`, as it is not declared as mutable
|
|
|
|
--> $DIR/unboxed-closures-mutate-upvar.rs:15:9
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let n = 0;
|
2019-04-22 02:40:08 -05:00
|
|
|
| - help: consider changing this to be mutable: `mut n`
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let mut f = to_fn_mut(|| {
|
2019-04-22 02:40:08 -05:00
|
|
|
LL | n += 1;
|
|
|
|
| ^^^^^^ cannot assign
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0594]: cannot assign to `n`, as it is not declared as mutable
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/unboxed-closures-mutate-upvar.rs:32:9
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let n = 0;
|
2019-04-22 02:40:08 -05:00
|
|
|
| - help: consider changing this to be mutable: `mut n`
|
2018-08-08 07:28:26 -05:00
|
|
|
...
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | n += 1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^ cannot assign
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0594]: cannot assign to `n`, as it is not declared as mutable
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/unboxed-closures-mutate-upvar.rs:46:9
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
LL | let n = 0;
|
|
|
|
| - help: consider changing this to be mutable: `mut n`
|
|
|
|
LL | let mut f = to_fn(move || {
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | n += 1;
|
2019-04-22 02:40:08 -05:00
|
|
|
| ^^^^^^ cannot assign
|
2018-08-08 07:28:26 -05:00
|
|
|
|
2019-04-22 02:40:08 -05:00
|
|
|
error[E0594]: cannot assign to `n`, as it is a captured variable in a `Fn` closure
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/unboxed-closures-mutate-upvar.rs:53:9
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
2022-07-30 00:37:48 -05:00
|
|
|
LL | fn to_fn<A:std::marker::Tuple,F:Fn<A>>(f: F) -> F { f }
|
|
|
|
| - change this to accept `FnMut` instead of `Fn`
|
2020-02-03 18:08:45 -06:00
|
|
|
...
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | let mut f = to_fn(move || {
|
2022-06-27 00:33:19 -05:00
|
|
|
| ----- ------- in this closure
|
|
|
|
| |
|
|
|
|
| expects `Fn` instead of `FnMut`
|
2022-06-27 00:45:35 -05:00
|
|
|
LL | n += 1;
|
|
|
|
| ^^^^^^ cannot assign
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|
2019-11-06 06:58:44 -06:00
|
|
|
For more information about this error, try `rustc --explain E0594`.
|