about summary refs log tree commit diff
path: root/tests/ui/closures/wrong-closure-arg-suggestion-125325.stderr
blob: e0cce8c4b314341eb24d0d00fc7ac48c182be14d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
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`.