rust/tests/ui/unboxed-closures/unboxed-closures-mutate-upvar.stderr

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

44 lines
1.5 KiB
Plaintext
Raw Normal View History

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;
| - help: consider changing this to be mutable: `mut n`
2019-03-09 12:03:44 +00:00
LL | let mut f = to_fn_mut(|| {
LL | n += 1;
| ^^^^^^ cannot assign
2018-08-08 12:28:26 +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;
| - 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;
| ^^^^^^ cannot assign
2018-08-08 12:28:26 +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
|
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;
| ^^^^^^ cannot assign
2018-08-08 12:28:26 +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`
...
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`.