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