11error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
22 --> $DIR/borrow-immutable-upvar-mutation.rs:21:27
33 |
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`
66...
77LL | let _f = to_fn(|| x = 42);
88 | ----- -- ^^^^^^ cannot assign
@@ -13,8 +13,8 @@ LL | let _f = to_fn(|| x = 42);
1313error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
1414 --> $DIR/borrow-immutable-upvar-mutation.rs:24:31
1515 |
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`
1818...
1919LL | let _g = to_fn(|| set(&mut y));
2020 | ----- -- ^^^^^^ cannot borrow as mutable
@@ -25,8 +25,8 @@ LL | let _g = to_fn(|| set(&mut y));
2525error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
2626 --> $DIR/borrow-immutable-upvar-mutation.rs:29:22
2727 |
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`
3030...
3131LL | to_fn(|| z = 42);
3232 | ----- -- ^^^^^^ cannot assign
@@ -37,8 +37,8 @@ LL | to_fn(|| z = 42);
3737error[E0594]: cannot assign to `x`, as it is a captured variable in a `Fn` closure
3838 --> $DIR/borrow-immutable-upvar-mutation.rs:36:32
3939 |
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`
4242...
4343LL | let _f = to_fn(move || x = 42);
4444 | ----- ------- ^^^^^^ cannot assign
@@ -49,8 +49,8 @@ LL | let _f = to_fn(move || x = 42);
4949error[E0596]: cannot borrow `y` as mutable, as it is a captured variable in a `Fn` closure
5050 --> $DIR/borrow-immutable-upvar-mutation.rs:39:36
5151 |
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`
5454...
5555LL | let _g = to_fn(move || set(&mut y));
5656 | ----- ------- ^^^^^^ cannot borrow as mutable
@@ -61,8 +61,8 @@ LL | let _g = to_fn(move || set(&mut y));
6161error[E0594]: cannot assign to `z`, as it is a captured variable in a `Fn` closure
6262 --> $DIR/borrow-immutable-upvar-mutation.rs:44:27
6363 |
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`
6666...
6767LL | to_fn(move || z = 42);
6868 | ----- ------- ^^^^^^ cannot assign
0 commit comments