]> git.lizzy.rs Git - rust.git/blob - src/test/ui/nll/closure-captures.stderr
Auto merge of #67060 - Centril:rollup-hwhdx4h, r=Centril
[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 |         ||
41    |         ^^ cannot borrow as mutable
42 LL |          x = 1;}
43    |          - mutable borrow occurs due to use of `x` in closure
44    |
45 help: consider changing this to accept closures that implement `FnMut`
46   --> $DIR/closure-captures.rs:26:12
47    |
48 LL |       fn_ref(|| {
49    |  ____________^
50 LL | |         ||
51 LL | |          x = 1;}
52    | |________________^
53
54 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
55   --> $DIR/closure-captures.rs:31:9
56    |
57 LL |         ||
58    |         ^^ cannot borrow as mutable
59 LL |     x = 1;});
60    |     - mutable borrow occurs due to use of `x` in closure
61    |
62 help: consider changing this to accept closures that implement `FnMut`
63   --> $DIR/closure-captures.rs:30:12
64    |
65 LL |       fn_ref(move || {
66    |  ____________^
67 LL | |         ||
68 LL | |     x = 1;});
69    | |___________^
70
71 error[E0594]: cannot assign to `x`, as it is not declared as mutable
72   --> $DIR/closure-captures.rs:39:10
73    |
74 LL | fn two_closures_ref(x: i32) {
75    |                     - help: consider changing this to be mutable: `mut x`
76 ...
77 LL |          x = 1;}
78    |          ^^^^^ cannot assign
79
80 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
81   --> $DIR/closure-captures.rs:38:9
82    |
83 LL |         ||
84    |         ^^ cannot borrow as mutable
85 LL |          x = 1;}
86    |          - mutable borrow occurs due to use of `x` in closure
87    |
88 help: consider changing this to accept closures that implement `FnMut`
89   --> $DIR/closure-captures.rs:37:12
90    |
91 LL |       fn_ref(|| {
92    |  ____________^
93 LL | |         ||
94 LL | |          x = 1;}
95    | |________________^
96
97 error[E0594]: cannot assign to `x`, as it is not declared as mutable
98   --> $DIR/closure-captures.rs:43:5
99    |
100 LL | fn two_closures_ref(x: i32) {
101    |                     - help: consider changing this to be mutable: `mut x`
102 ...
103 LL |     x = 1;});
104    |     ^^^^^ cannot assign
105
106 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
107   --> $DIR/closure-captures.rs:42:9
108    |
109 LL |         ||
110    |         ^^ cannot borrow as mutable
111 LL |     x = 1;});
112    |     - mutable borrow occurs due to use of `x` in closure
113    |
114 help: consider changing this to accept closures that implement `FnMut`
115   --> $DIR/closure-captures.rs:41:12
116    |
117 LL |       fn_ref(move || {
118    |  ____________^
119 LL | |         ||
120 LL | |     x = 1;});
121    | |___________^
122
123 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
124   --> $DIR/closure-captures.rs:48:9
125    |
126 LL |         ||
127    |         ^^ cannot borrow as mutable
128 LL |         *x = 1;});
129    |          - mutable borrow occurs due to use of `x` in closure
130    |
131 help: consider changing this to accept closures that implement `FnMut`
132   --> $DIR/closure-captures.rs:47:12
133    |
134 LL |       fn_ref(|| {
135    |  ____________^
136 LL | |         ||
137 LL | |         *x = 1;});
138    | |________________^
139
140 error[E0596]: cannot borrow `x` as mutable, as it is a captured variable in a `Fn` closure
141   --> $DIR/closure-captures.rs:51:9
142    |
143 LL |         ||
144    |         ^^ cannot borrow as mutable
145 LL |         *x = 1;});
146    |          - mutable borrow occurs due to use of `x` in closure
147    |
148 help: consider changing this to accept closures that implement `FnMut`
149   --> $DIR/closure-captures.rs:50:12
150    |
151 LL |       fn_ref(move || {
152    |  ____________^
153 LL | |         ||
154 LL | |         *x = 1;});
155    | |________________^
156
157 error: aborting due to 12 previous errors
158
159 Some errors have detailed explanations: E0594, E0596.
160 For more information about an error, try `rustc --explain E0594`.