fork/rust

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

borsAuto merge of #69444 - pietroalbini:stable-next-final-v2-new, r=pietroalbinif3e1a954d2e

1.41.1
16.4 KiB363 linesraw
1error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
2  --> $DIR/region-borrow-params-issue-29793-small.rs:9:17
3   |
4LL |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
5   |                 ^^^^^^^^^        - `x` is borrowed here
6   |                 |
7   |                 may outlive borrowed value `x`
8   |
9note: closure is returned here
10  --> $DIR/region-borrow-params-issue-29793-small.rs:12:16
11   |
12LL |         return f;
13   |                ^
14help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
15   |
16LL |         let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
17   |                 ^^^^^^^^^^^^^^
18
19error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
20  --> $DIR/region-borrow-params-issue-29793-small.rs:9:17
21   |
22LL |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
23   |                 ^^^^^^^^^                   - `y` is borrowed here
24   |                 |
25   |                 may outlive borrowed value `y`
26   |
27note: closure is returned here
28  --> $DIR/region-borrow-params-issue-29793-small.rs:12:16
29   |
30LL |         return f;
31   |                ^
32help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
33   |
34LL |         let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
35   |                 ^^^^^^^^^^^^^^
36
37error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
38  --> $DIR/region-borrow-params-issue-29793-small.rs:24:17
39   |
40LL |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
41   |                 ^^^^^^^^^        - `x` is borrowed here
42   |                 |
43   |                 may outlive borrowed value `x`
44   |
45note: closure is returned here
46  --> $DIR/region-borrow-params-issue-29793-small.rs:27:9
47   |
48LL |         f
49   |         ^
50help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
51   |
52LL |         let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
53   |                 ^^^^^^^^^^^^^^
54
55error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
56  --> $DIR/region-borrow-params-issue-29793-small.rs:24:17
57   |
58LL |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
59   |                 ^^^^^^^^^                   - `y` is borrowed here
60   |                 |
61   |                 may outlive borrowed value `y`
62   |
63note: closure is returned here
64  --> $DIR/region-borrow-params-issue-29793-small.rs:27:9
65   |
66LL |         f
67   |         ^
68help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
69   |
70LL |         let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
71   |                 ^^^^^^^^^^^^^^
72
73error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
74  --> $DIR/region-borrow-params-issue-29793-small.rs:55:17
75   |
76LL |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
77   |                 ^^^^^^^^^        - `x` is borrowed here
78   |                 |
79   |                 may outlive borrowed value `x`
80   |
81note: closure is returned here
82  --> $DIR/region-borrow-params-issue-29793-small.rs:58:16
83   |
84LL |         return Box::new(f);
85   |                ^^^^^^^^^^^
86help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
87   |
88LL |         let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
89   |                 ^^^^^^^^^^^^^^
90
91error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
92  --> $DIR/region-borrow-params-issue-29793-small.rs:55:17
93   |
94LL |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
95   |                 ^^^^^^^^^                   - `y` is borrowed here
96   |                 |
97   |                 may outlive borrowed value `y`
98   |
99note: closure is returned here
100  --> $DIR/region-borrow-params-issue-29793-small.rs:58:16
101   |
102LL |         return Box::new(f);
103   |                ^^^^^^^^^^^
104help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
105   |
106LL |         let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
107   |                 ^^^^^^^^^^^^^^
108
109error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
110  --> $DIR/region-borrow-params-issue-29793-small.rs:66:17
111   |
112LL |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
113   |                 ^^^^^^^^^        - `x` is borrowed here
114   |                 |
115   |                 may outlive borrowed value `x`
116   |
117note: closure is returned here
118  --> $DIR/region-borrow-params-issue-29793-small.rs:69:9
119   |
120LL |         Box::new(f)
121   |         ^^^^^^^^^^^
122help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
123   |
124LL |         let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
125   |                 ^^^^^^^^^^^^^^
126
127error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
128  --> $DIR/region-borrow-params-issue-29793-small.rs:66:17
129   |
130LL |         let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
131   |                 ^^^^^^^^^                   - `y` is borrowed here
132   |                 |
133   |                 may outlive borrowed value `y`
134   |
135note: closure is returned here
136  --> $DIR/region-borrow-params-issue-29793-small.rs:69:9
137   |
138LL |         Box::new(f)
139   |         ^^^^^^^^^^^
140help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
141   |
142LL |         let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
143   |                 ^^^^^^^^^^^^^^
144
145error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
146  --> $DIR/region-borrow-params-issue-29793-small.rs:90:21
147   |
148LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
149   |                     ^^^^^^^^^        - `x` is borrowed here
150   |                     |
151   |                     may outlive borrowed value `x`
152   |
153note: closure is returned here
154  --> $DIR/region-borrow-params-issue-29793-small.rs:93:20
155   |
156LL |             return Box::new(f);
157   |                    ^^^^^^^^^^^
158help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
159   |
160LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
161   |                     ^^^^^^^^^^^^^^
162
163error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
164  --> $DIR/region-borrow-params-issue-29793-small.rs:90:21
165   |
166LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
167   |                     ^^^^^^^^^                   - `y` is borrowed here
168   |                     |
169   |                     may outlive borrowed value `y`
170   |
171note: closure is returned here
172  --> $DIR/region-borrow-params-issue-29793-small.rs:93:20
173   |
174LL |             return Box::new(f);
175   |                    ^^^^^^^^^^^
176help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
177   |
178LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
179   |                     ^^^^^^^^^^^^^^
180
181error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
182  --> $DIR/region-borrow-params-issue-29793-small.rs:104:21
183   |
184LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
185   |                     ^^^^^^^^^        - `x` is borrowed here
186   |                     |
187   |                     may outlive borrowed value `x`
188   |
189note: closure is returned here
190  --> $DIR/region-borrow-params-issue-29793-small.rs:107:13
191   |
192LL |             Box::new(f)
193   |             ^^^^^^^^^^^
194help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
195   |
196LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
197   |                     ^^^^^^^^^^^^^^
198
199error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
200  --> $DIR/region-borrow-params-issue-29793-small.rs:104:21
201   |
202LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
203   |                     ^^^^^^^^^                   - `y` is borrowed here
204   |                     |
205   |                     may outlive borrowed value `y`
206   |
207note: closure is returned here
208  --> $DIR/region-borrow-params-issue-29793-small.rs:107:13
209   |
210LL |             Box::new(f)
211   |             ^^^^^^^^^^^
212help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
213   |
214LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
215   |                     ^^^^^^^^^^^^^^
216
217error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
218  --> $DIR/region-borrow-params-issue-29793-small.rs:132:21
219   |
220LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
221   |                     ^^^^^^^^^        - `x` is borrowed here
222   |                     |
223   |                     may outlive borrowed value `x`
224   |
225note: closure is returned here
226  --> $DIR/region-borrow-params-issue-29793-small.rs:135:20
227   |
228LL |             return Box::new(f);
229   |                    ^^^^^^^^^^^
230help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
231   |
232LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
233   |                     ^^^^^^^^^^^^^^
234
235error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
236  --> $DIR/region-borrow-params-issue-29793-small.rs:132:21
237   |
238LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
239   |                     ^^^^^^^^^                   - `y` is borrowed here
240   |                     |
241   |                     may outlive borrowed value `y`
242   |
243note: closure is returned here
244  --> $DIR/region-borrow-params-issue-29793-small.rs:135:20
245   |
246LL |             return Box::new(f);
247   |                    ^^^^^^^^^^^
248help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
249   |
250LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
251   |                     ^^^^^^^^^^^^^^
252
253error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
254  --> $DIR/region-borrow-params-issue-29793-small.rs:147:21
255   |
256LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
257   |                     ^^^^^^^^^        - `x` is borrowed here
258   |                     |
259   |                     may outlive borrowed value `x`
260   |
261note: closure is returned here
262  --> $DIR/region-borrow-params-issue-29793-small.rs:150:13
263   |
264LL |             Box::new(f)
265   |             ^^^^^^^^^^^
266help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
267   |
268LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
269   |                     ^^^^^^^^^^^^^^
270
271error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
272  --> $DIR/region-borrow-params-issue-29793-small.rs:147:21
273   |
274LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
275   |                     ^^^^^^^^^                   - `y` is borrowed here
276   |                     |
277   |                     may outlive borrowed value `y`
278   |
279note: closure is returned here
280  --> $DIR/region-borrow-params-issue-29793-small.rs:150:13
281   |
282LL |             Box::new(f)
283   |             ^^^^^^^^^^^
284help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
285   |
286LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
287   |                     ^^^^^^^^^^^^^^
288
289error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
290  --> $DIR/region-borrow-params-issue-29793-small.rs:175:21
291   |
292LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
293   |                     ^^^^^^^^^        - `x` is borrowed here
294   |                     |
295   |                     may outlive borrowed value `x`
296   |
297note: closure is returned here
298  --> $DIR/region-borrow-params-issue-29793-small.rs:178:20
299   |
300LL |             return Box::new(f);
301   |                    ^^^^^^^^^^^
302help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
303   |
304LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
305   |                     ^^^^^^^^^^^^^^
306
307error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
308  --> $DIR/region-borrow-params-issue-29793-small.rs:175:21
309   |
310LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
311   |                     ^^^^^^^^^                   - `y` is borrowed here
312   |                     |
313   |                     may outlive borrowed value `y`
314   |
315note: closure is returned here
316  --> $DIR/region-borrow-params-issue-29793-small.rs:178:20
317   |
318LL |             return Box::new(f);
319   |                    ^^^^^^^^^^^
320help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
321   |
322LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
323   |                     ^^^^^^^^^^^^^^
324
325error[E0373]: closure may outlive the current function, but it borrows `x`, which is owned by the current function
326  --> $DIR/region-borrow-params-issue-29793-small.rs:189:21
327   |
328LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
329   |                     ^^^^^^^^^        - `x` is borrowed here
330   |                     |
331   |                     may outlive borrowed value `x`
332   |
333note: closure is returned here
334  --> $DIR/region-borrow-params-issue-29793-small.rs:192:13
335   |
336LL |             Box::new(f)
337   |             ^^^^^^^^^^^
338help: to force the closure to take ownership of `x` (and any other referenced variables), use the `move` keyword
339   |
340LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
341   |                     ^^^^^^^^^^^^^^
342
343error[E0373]: closure may outlive the current function, but it borrows `y`, which is owned by the current function
344  --> $DIR/region-borrow-params-issue-29793-small.rs:189:21
345   |
346LL |             let f = |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
347   |                     ^^^^^^^^^                   - `y` is borrowed here
348   |                     |
349   |                     may outlive borrowed value `y`
350   |
351note: closure is returned here
352  --> $DIR/region-borrow-params-issue-29793-small.rs:192:13
353   |
354LL |             Box::new(f)
355   |             ^^^^^^^^^^^
356help: to force the closure to take ownership of `y` (and any other referenced variables), use the `move` keyword
357   |
358LL |             let f = move |t: bool| if t { x } else { y }; // (separate errors for `x` vs `y`)
359   |                     ^^^^^^^^^^^^^^
360
361error: aborting due to 20 previous errors
362
363For more information about this error, try `rustc --explain E0373`.