]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/closure-captures.stderr
Rollup merge of #103146 - joboet:cleanup_pthread_condvar, r=Mark-Simulacrum
[rust.git] / src / test / ui / nll / closure-captures.stderr
1 error[E0594]: cannot assign to `x`, as it is not declared as mutable
2   --> $DIR/closure-captures.rs:7:5
3    |
4 LL | fn one_closure(x: i32) {
5    |                - help: consider changing this to be mutable: `mut x`
6 LL |     ||
7 LL |     x = 1;
8    |     ^^^^^ cannot assign
9
10 error[E0594]: cannot assign to `x`, as it is not declared as mutable
11   --> $DIR/closure-captures.rs:9:5
12    |
13 LL | fn one_closure(x: i32) {
14    |                - help: consider changing this to be mutable: `mut x`
15 ...
16 LL |     x = 1;
17    |     ^^^^^ cannot assign
18
19 error[E0594]: cannot assign to `x`, as it is not declared as mutable
20   --> $DIR/closure-captures.rs:15:9
21    |
22 LL | fn two_closures(x: i32) {
23    |                 - help: consider changing this to be mutable: `mut x`
24 ...
25 LL |         x = 1;
26    |         ^^^^^ cannot assign
27
28 error[E0594]: cannot assign to `x`, as it is not declared as mutable
29   --> $DIR/closure-captures.rs:19:9
30    |
31 LL | fn two_closures(x: i32) {
32    |                 - help: consider changing this to be mutable: `mut x`
33 ...
34 LL |         x = 1;
35    |         ^^^^^ cannot assign
36
37 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
38   --> $DIR/closure-captures.rs:27:9
39    |
40 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
41    |                       - change this to accept `FnMut` instead of `Fn`
42 ...
43 LL |     fn_ref(|| {
44    |     ------ -- in this closure
45    |     |
46    |     expects `Fn` instead of `FnMut`
47 LL |         ||
48    |         ^^ cannot borrow as mutable
49 LL |          x = 1;}
50    |          - mutable borrow occurs due to use of `x` in closure
51
52 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
53   --> $DIR/closure-captures.rs:31:9
54    |
55 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
56    |                       - change this to accept `FnMut` instead of `Fn`
57 ...
58 LL |     fn_ref(move || {
59    |     ------ ------- in this closure
60    |     |
61    |     expects `Fn` instead of `FnMut`
62 LL |         ||
63    |         ^^ cannot borrow as mutable
64 LL |     x = 1;});
65    |     - mutable borrow occurs due to use of `x` in closure
66
67 error[E0594]: cannot assign to `x`, as it is not declared as mutable
68   --> $DIR/closure-captures.rs:39:10
69    |
70 LL | fn two_closures_ref(x: i32) {
71    |                     - help: consider changing this to be mutable: `mut x`
72 ...
73 LL |          x = 1;}
74    |          ^^^^^ cannot assign
75
76 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
77   --> $DIR/closure-captures.rs:38:9
78    |
79 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
80    |                       - change this to accept `FnMut` instead of `Fn`
81 ...
82 LL |     fn_ref(|| {
83    |     ------ -- in this closure
84    |     |
85    |     expects `Fn` instead of `FnMut`
86 LL |         ||
87    |         ^^ cannot borrow as mutable
88 LL |          x = 1;}
89    |          - mutable borrow occurs due to use of `x` in closure
90
91 error[E0594]: cannot assign to `x`, as it is not declared as mutable
92   --> $DIR/closure-captures.rs:43:5
93    |
94 LL | fn two_closures_ref(x: i32) {
95    |                     - help: consider changing this to be mutable: `mut x`
96 ...
97 LL |     x = 1;});
98    |     ^^^^^ cannot assign
99
100 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
101   --> $DIR/closure-captures.rs:42:9
102    |
103 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
104    |                       - change this to accept `FnMut` instead of `Fn`
105 ...
106 LL |     fn_ref(move || {
107    |     ------ ------- in this closure
108    |     |
109    |     expects `Fn` instead of `FnMut`
110 LL |         ||
111    |         ^^ cannot borrow as mutable
112 LL |     x = 1;});
113    |     - mutable borrow occurs due to use of `x` in closure
114
115 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
116   --> $DIR/closure-captures.rs:48:9
117    |
118 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
119    |                       - change this to accept `FnMut` instead of `Fn`
120 ...
121 LL |     fn_ref(|| {
122    |     ------ -- in this closure
123    |     |
124    |     expects `Fn` instead of `FnMut`
125 LL |         ||
126    |         ^^ cannot borrow as mutable
127 LL |         *x = 1;});
128    |         -- mutable borrow occurs due to use of `x` in closure
129
130 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
131   --> $DIR/closure-captures.rs:51:9
132    |
133 LL | fn fn_ref<F: Fn()>(f: F) -> F { f }
134    |                       - change this to accept `FnMut` instead of `Fn`
135 ...
136 LL |     fn_ref(move || {
137    |     ------ ------- in this closure
138    |     |
139    |     expects `Fn` instead of `FnMut`
140 LL |         ||
141    |         ^^ cannot borrow as mutable
142 LL |         *x = 1;});
143    |         -- mutable borrow occurs due to use of `x` in closure
144
145 error: aborting due to 12 previous errors
146
147 Some errors have detailed explanations: E0594, E0596.
148 For more information about an error, try `rustc --explain E0594`.