fork/rust

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

borsAuto merge of #103046 - JanBeh:PR_clarify_cmp_terminology, r=workingjubilee3bcad65fbf6

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