1
1
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
2
2
--> $DIR/borrow-immutable-upvar-mutation.rs:21:27
3
3
|
4
- LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
5
- | - change this to accept `FnMut` instead of `Fn`
4
+ LL | fn to_fn<A: std::marker::Tuple , F: Fn<A>>(f: F) -> F {
5
+ | - change this to accept `FnMut` instead of `Fn`
6
6
...
7
7
LL | let _f = to_fn(|| x = 42);
8
8
| ----- -- ^^^^^^ cannot assign
@@ -13,8 +13,8 @@ LL | let _f = to_fn(|| x = 42);
13
13
error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
14
14
--> $DIR/borrow-immutable-upvar-mutation.rs:24:31
15
15
|
16
- LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
17
- | - change this to accept `FnMut` instead of `Fn`
16
+ LL | fn to_fn<A: std::marker::Tuple , F: Fn<A>>(f: F) -> F {
17
+ | - change this to accept `FnMut` instead of `Fn`
18
18
...
19
19
LL | let _g = to_fn(|| set(&mut y));
20
20
| ----- -- ^^^^^^ cannot borrow as mutable
@@ -25,8 +25,8 @@ LL | let _g = to_fn(|| set(&mut y));
25
25
error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
26
26
--> $DIR/borrow-immutable-upvar-mutation.rs:29:22
27
27
|
28
- LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
29
- | - change this to accept `FnMut` instead of `Fn`
28
+ LL | fn to_fn<A: std::marker::Tuple , F: Fn<A>>(f: F) -> F {
29
+ | - change this to accept `FnMut` instead of `Fn`
30
30
...
31
31
LL | to_fn(|| z = 42);
32
32
| ----- -- ^^^^^^ cannot assign
@@ -37,8 +37,8 @@ LL | to_fn(|| z = 42);
37
37
error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
38
38
--> $DIR/borrow-immutable-upvar-mutation.rs:36:32
39
39
|
40
- LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
41
- | - change this to accept `FnMut` instead of `Fn`
40
+ LL | fn to_fn<A: std::marker::Tuple , F: Fn<A>>(f: F) -> F {
41
+ | - change this to accept `FnMut` instead of `Fn`
42
42
...
43
43
LL | let _f = to_fn(move || x = 42);
44
44
| ----- ------- ^^^^^^ cannot assign
@@ -49,8 +49,8 @@ LL | let _f = to_fn(move || x = 42);
49
49
error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
50
50
--> $DIR/borrow-immutable-upvar-mutation.rs:39:36
51
51
|
52
- LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
53
- | - change this to accept `FnMut` instead of `Fn`
52
+ LL | fn to_fn<A: std::marker::Tuple , F: Fn<A>>(f: F) -> F {
53
+ | - change this to accept `FnMut` instead of `Fn`
54
54
...
55
55
LL | let _g = to_fn(move || set(&mut y));
56
56
| ----- ------- ^^^^^^ cannot borrow as mutable
@@ -61,8 +61,8 @@ LL | let _g = to_fn(move || set(&mut y));
61
61
error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
62
62
--> $DIR/borrow-immutable-upvar-mutation.rs:44:27
63
63
|
64
- LL | fn to_fn<A, F: Fn<A>>(f: F) -> F {
65
- | - change this to accept `FnMut` instead of `Fn`
64
+ LL | fn to_fn<A: std::marker::Tuple , F: Fn<A>>(f: F) -> F {
65
+ | - change this to accept `FnMut` instead of `Fn`
66
66
...
67
67
LL | to_fn(move || z = 42);
68
68
| ----- ------- ^^^^^^ cannot assign
0 commit comments