1
1
error[E0597]: `x` does not live long enough
2
- --> $DIR/migration-note.rs:182 :17
2
+ --> $DIR/migration-note.rs:184 :17
3
3
|
4
4
LL | let x = vec![0];
5
5
| - binding `x` declared here
50
50
LL | }
51
51
| - `x` dropped here while still borrowed
52
52
|
53
+ note: requirement that `x` is borrowed for `'static` introduced here
54
+ --> $DIR/migration-note.rs:34:37
55
+ |
56
+ LL | fn needs_static(_: impl Sized + 'static) {}
57
+ | ^^^^^^^
53
58
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
54
59
--> $DIR/migration-note.rs:29:13
55
60
|
@@ -61,7 +66,7 @@ LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> {
61
66
| ++++++++
62
67
63
68
error[E0505]: cannot move out of `x` because it is borrowed
64
- --> $DIR/migration-note.rs:48 :8
69
+ --> $DIR/migration-note.rs:49 :8
65
70
|
66
71
LL | let x = vec![1];
67
72
| - binding `x` declared here
76
81
| - borrow might be used here, when `a` is dropped and runs the destructor for type `impl std::fmt::Display`
77
82
|
78
83
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
79
- --> $DIR/migration-note.rs:43 :13
84
+ --> $DIR/migration-note.rs:44 :13
80
85
|
81
86
LL | let a = display_len(&x);
82
87
| ^^^^^^^^^^^^^^^
@@ -90,7 +95,7 @@ LL | let a = display_len(&x.clone());
90
95
| ++++++++
91
96
92
97
error[E0499]: cannot borrow `x` as mutable more than once at a time
93
- --> $DIR/migration-note.rs:66 :5
98
+ --> $DIR/migration-note.rs:67 :5
94
99
|
95
100
LL | let a = display_len_mut(&mut x);
96
101
| ------ first mutable borrow occurs here
@@ -102,7 +107,7 @@ LL | println!("{a}");
102
107
| - first borrow later used here
103
108
|
104
109
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
105
- --> $DIR/migration-note.rs:63 :13
110
+ --> $DIR/migration-note.rs:64 :13
106
111
|
107
112
LL | let a = display_len_mut(&mut x);
108
113
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -112,7 +117,7 @@ LL | fn display_len_mut<T>(x: &mut Vec<T>) -> impl Display + use<T> {
112
117
| ++++++++
113
118
114
119
error[E0597]: `x` does not live long enough
115
- --> $DIR/migration-note.rs:76 :29
120
+ --> $DIR/migration-note.rs:77 :29
116
121
|
117
122
LL | let mut x = vec![1];
118
123
| ----- binding `x` declared here
@@ -126,8 +131,13 @@ LL |
126
131
LL | }
127
132
| - `x` dropped here while still borrowed
128
133
|
134
+ note: requirement that `x` is borrowed for `'static` introduced here
135
+ --> $DIR/migration-note.rs:82:37
136
+ |
137
+ LL | fn needs_static(_: impl Sized + 'static) {}
138
+ | ^^^^^^^
129
139
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
130
- --> $DIR/migration-note.rs:76 :13
140
+ --> $DIR/migration-note.rs:77 :13
131
141
|
132
142
LL | let a = display_len_mut(&mut x);
133
143
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -137,7 +147,7 @@ LL | fn display_len_mut<T>(x: &mut Vec<T>) -> impl Display + use<T> {
137
147
| ++++++++
138
148
139
149
error[E0505]: cannot move out of `x` because it is borrowed
140
- --> $DIR/migration-note.rs:95 :8
150
+ --> $DIR/migration-note.rs:97 :8
141
151
|
142
152
LL | let mut x = vec![1];
143
153
| ----- binding `x` declared here
@@ -152,7 +162,7 @@ LL | }
152
162
| - borrow might be used here, when `a` is dropped and runs the destructor for type `impl std::fmt::Display`
153
163
|
154
164
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
155
- --> $DIR/migration-note.rs:90 :13
165
+ --> $DIR/migration-note.rs:92 :13
156
166
|
157
167
LL | let a = display_len_mut(&mut x);
158
168
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -166,7 +176,7 @@ LL | let a = display_len_mut(&mut x.clone());
166
176
| ++++++++
167
177
168
178
error[E0506]: cannot assign to `s.f` because it is borrowed
169
- --> $DIR/migration-note.rs:115 :5
179
+ --> $DIR/migration-note.rs:117 :5
170
180
|
171
181
LL | let a = display_field(&s.f);
172
182
| ---- `s.f` is borrowed here
@@ -178,7 +188,7 @@ LL | println!("{a}");
178
188
| - borrow later used here
179
189
|
180
190
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
181
- --> $DIR/migration-note.rs:112 :13
191
+ --> $DIR/migration-note.rs:114 :13
182
192
|
183
193
LL | let a = display_field(&s.f);
184
194
| ^^^^^^^^^^^^^^^^^^^
@@ -188,7 +198,7 @@ LL | fn display_field<T: Copy + Display>(t: &T) -> impl Display + use<T> {
188
198
| ++++++++
189
199
190
200
error[E0506]: cannot assign to `s.f` because it is borrowed
191
- --> $DIR/migration-note.rs:131 :5
201
+ --> $DIR/migration-note.rs:133 :5
192
202
|
193
203
LL | let a = display_field(&mut s.f);
194
204
| -------- `s.f` is borrowed here
@@ -200,7 +210,7 @@ LL | println!("{a}");
200
210
| - borrow later used here
201
211
|
202
212
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
203
- --> $DIR/migration-note.rs:128 :13
213
+ --> $DIR/migration-note.rs:130 :13
204
214
|
205
215
LL | let a = display_field(&mut s.f);
206
216
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -210,7 +220,7 @@ LL | fn display_field<T: Copy + Display>(t: &T) -> impl Display + use<T> {
210
220
| ++++++++
211
221
212
222
error[E0503]: cannot use `s.f` because it was mutably borrowed
213
- --> $DIR/migration-note.rs:143 :5
223
+ --> $DIR/migration-note.rs:145 :5
214
224
|
215
225
LL | let a = display_field(&mut s.f);
216
226
| -------- `s.f` is borrowed here
@@ -222,7 +232,7 @@ LL | println!("{a}");
222
232
| - borrow later used here
223
233
|
224
234
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
225
- --> $DIR/migration-note.rs:140 :13
235
+ --> $DIR/migration-note.rs:142 :13
226
236
|
227
237
LL | let a = display_field(&mut s.f);
228
238
| ^^^^^^^^^^^^^^^^^^^^^^^
@@ -232,7 +242,7 @@ LL | fn display_field<T: Copy + Display>(t: &T) -> impl Display + use<T> {
232
242
| ++++++++
233
243
234
244
error[E0597]: `z.f` does not live long enough
235
- --> $DIR/migration-note.rs:159 :25
245
+ --> $DIR/migration-note.rs:161 :25
236
246
|
237
247
LL | let z = Z { f: vec![1] };
238
248
| - binding `z` declared here
@@ -248,7 +258,7 @@ LL | }
248
258
|
249
259
= note: values in a scope are dropped in the opposite order they are defined
250
260
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
251
- --> $DIR/migration-note.rs:159 :13
261
+ --> $DIR/migration-note.rs:161 :13
252
262
|
253
263
LL | x = display_len(&z.f);
254
264
| ^^^^^^^^^^^^^^^^^
@@ -258,7 +268,7 @@ LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> {
258
268
| ++++++++
259
269
260
270
error[E0716]: temporary value dropped while borrowed
261
- --> $DIR/migration-note.rs:170 :40
271
+ --> $DIR/migration-note.rs:172 :40
262
272
|
263
273
LL | let x = { let x = display_len(&mut vec![0]); x };
264
274
| ^^^^^^^ - - borrow later used here
@@ -268,7 +278,7 @@ LL | let x = { let x = display_len(&mut vec![0]); x };
268
278
|
269
279
= note: consider using a `let` binding to create a longer lived value
270
280
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
271
- --> $DIR/migration-note.rs:170 :23
281
+ --> $DIR/migration-note.rs:172 :23
272
282
|
273
283
LL | let x = { let x = display_len(&mut vec![0]); x };
274
284
| ^^^^^^^^^^^^^^^^^^^^^^^^^
@@ -279,7 +289,7 @@ LL | fn display_len<T>(x: &Vec<T>) -> impl Display + use<T> {
279
289
| ++++++++
280
290
281
291
error[E0505]: cannot move out of `x` because it is borrowed
282
- --> $DIR/migration-note.rs:198 :10
292
+ --> $DIR/migration-note.rs:200 :10
283
293
|
284
294
LL | let x = String::new();
285
295
| - binding `x` declared here
@@ -294,12 +304,12 @@ LL | }
294
304
| - borrow might be used here, when `y` is dropped and runs the destructor for type `impl Sized`
295
305
|
296
306
note: this call may capture more lifetimes than intended, because Rust 2024 has adjusted the `impl Trait` lifetime capture rules
297
- --> $DIR/migration-note.rs:195 :13
307
+ --> $DIR/migration-note.rs:197 :13
298
308
|
299
309
LL | let y = capture_apit(&x);
300
310
| ^^^^^^^^^^^^^^^^
301
311
note: you could use a `use<...>` bound to explicitly specify captures, but argument-position `impl Trait`s are not nameable
302
- --> $DIR/migration-note.rs:189 :21
312
+ --> $DIR/migration-note.rs:191 :21
303
313
|
304
314
LL | fn capture_apit(x: &impl Sized) -> impl Sized {}
305
315
| ^^^^^^^^^^
0 commit comments