fork/rust

git clone https://git.julia.blue/fork/rust

borsAuto merge of #66089 - Mark-Simulacrum:stable-next, r=Mark-Simulacrum4560ea788cb

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