mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-26 08:44:35 +00:00
29 lines
1.0 KiB
Plaintext
29 lines
1.0 KiB
Plaintext
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
|
|
--> $DIR/wrong-closure-arg-suggestion-125325.rs:23:21
|
|
|
|
|
LL | fn assoc_func(&self, _f: impl Fn()) -> usize {
|
|
| --------- change this to accept `FnMut` instead of `Fn`
|
|
...
|
|
LL | s.assoc_func(|| x = ());
|
|
| --------------^^^^^^-
|
|
| | | |
|
|
| | | cannot assign
|
|
| | in this closure
|
|
| expects `Fn` instead of `FnMut`
|
|
|
|
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
|
|
--> $DIR/wrong-closure-arg-suggestion-125325.rs:25:13
|
|
|
|
|
LL | fn func(_f: impl Fn()) -> usize {
|
|
| --------- change this to accept `FnMut` instead of `Fn`
|
|
...
|
|
LL | func(|| x = ())
|
|
| ---- -- ^^^^^^ cannot assign
|
|
| | |
|
|
| | in this closure
|
|
| expects `Fn` instead of `FnMut`
|
|
|
|
error: aborting due to 2 previous errors
|
|
|
|
For more information about this error, try `rustc --explain E0594`.
|