2018-08-08 07:28:26 -05:00
|
|
|
error[E0595]: closure cannot assign to immutable local variable `n`
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/unboxed-closures-mutate-upvar.rs:14:27
|
2018-08-08 07:28:26 -05:00
|
|
|
|
|
|
|
|
LL | let n = 0;
|
2018-09-12 13:13:40 -05:00
|
|
|
| - help: make this binding mutable: `mut n`
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | let mut f = to_fn_mut(|| {
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^ cannot borrow mutably
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to captured outer variable in an `FnMut` closure
|
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;
|
|
|
|
| - help: consider making `n` mutable: `mut n`
|
|
|
|
...
|
2019-03-09 06:03:44 -06:00
|
|
|
LL | n += 1;
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
error[E0594]: cannot assign to captured outer variable in an `Fn` closure
|
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-03-09 06:03:44 -06:00
|
|
|
LL | n += 1;
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
= note: `Fn` closures cannot capture their enclosing environment for modifications
|
|
|
|
help: consider changing this closure to take self by mutable reference
|
2018-12-25 09:56:47 -06:00
|
|
|
--> $DIR/unboxed-closures-mutate-upvar.rs:45: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[E0594]: cannot assign to captured outer variable in an `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;
|
2018-08-08 07:28:26 -05:00
|
|
|
| ^^^^^^
|
|
|
|
|
|
|
|
|
= note: `Fn` closures cannot capture their enclosing environment for modifications
|
|
|
|
help: consider changing this closure to take self by mutable reference
|
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
|
|
|
|
|
2019-04-17 12:26:38 -05:00
|
|
|
For more information about this error, try `rustc --explain E0595`.
|