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
|
|
|
|
|
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
|
|
|
help: consider changing this to accept closures that implement `FnMut`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/unboxed-closures-mutate-upvar.rs:52:23
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let mut f = to_fn(move || {
|
|
|
|
| _______________________^
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | | n += 1;
|
2018-08-08 07:28:26 -05:00
|
|
|
LL | | });
|
|
|
|
| |_____^
|
|
|
|
|
|
|
|
error: aborting due to 4 previous errors
|
|
|
|
|