@@ -108,7 +108,28 @@ LL + fn g(mut x: impl Foo) -> Option<()> { x.next() }
108
108
|
109
109
110
110
error[E0106]: missing lifetime specifier
111
- --> $DIR/impl-trait-missing-lifetime-gated.rs:58:41
111
+ --> $DIR/impl-trait-missing-lifetime-gated.rs:58:39
112
+ |
113
+ LL | fn g(mut x: impl Foo<>) -> Option<&()> { x.next() }
114
+ | ^ expected named lifetime parameter
115
+ |
116
+ = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
117
+ help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
118
+ |
119
+ LL | fn g(mut x: impl Foo<>) -> Option<&'static ()> { x.next() }
120
+ | +++++++
121
+ help: consider introducing a named lifetime parameter
122
+ |
123
+ LL | fn g<'a>(mut x: impl Foo<>) -> Option<&'a ()> { x.next() }
124
+ | ++++ ++
125
+ help: alternatively, you might want to return an owned value
126
+ |
127
+ LL - fn g(mut x: impl Foo<>) -> Option<&()> { x.next() }
128
+ LL + fn g(mut x: impl Foo<>) -> Option<()> { x.next() }
129
+ |
130
+
131
+ error[E0106]: missing lifetime specifier
132
+ --> $DIR/impl-trait-missing-lifetime-gated.rs:69:41
112
133
|
113
134
LL | fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() }
114
135
| ^ expected named lifetime parameter
@@ -129,7 +150,7 @@ LL + fn g(mut x: impl Foo<()>) -> Option<()> { x.next() }
129
150
|
130
151
131
152
warning: elided lifetime has a name
132
- --> $DIR/impl-trait-missing-lifetime-gated.rs:64 :57
153
+ --> $DIR/impl-trait-missing-lifetime-gated.rs:75 :57
133
154
|
134
155
LL | fn resolved_anonymous<'a, T: 'a>(f: impl Fn(&'a str) -> &T) {
135
156
| -- lifetime `'a` declared here ^ this elided lifetime gets resolved as `'a`
@@ -219,6 +240,32 @@ LL | fn g<'a>(mut x: impl Foo<'a>) -> Option<&()> { x.next() }
219
240
error[E0658]: anonymous lifetimes in `impl Trait` are unstable
220
241
--> $DIR/impl-trait-missing-lifetime-gated.rs:55:22
221
242
|
243
+ LL | fn f(_: impl Foo<>) {}
244
+ | ^ expected named lifetime parameter
245
+ |
246
+ = help: add `#![feature(anonymous_lifetime_in_impl_trait)]` to the crate attributes to enable
247
+ = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
248
+ help: consider introducing a named lifetime parameter
249
+ |
250
+ LL | fn f<'a>(_: impl Foo<'a>) {}
251
+ | ++++ ++
252
+
253
+ error[E0658]: anonymous lifetimes in `impl Trait` are unstable
254
+ --> $DIR/impl-trait-missing-lifetime-gated.rs:58:26
255
+ |
256
+ LL | fn g(mut x: impl Foo<>) -> Option<&()> { x.next() }
257
+ | ^ expected named lifetime parameter
258
+ |
259
+ = help: add `#![feature(anonymous_lifetime_in_impl_trait)]` to the crate attributes to enable
260
+ = note: this compiler was built on YYYY-MM-DD; consider upgrading it if it is out of date
261
+ help: consider introducing a named lifetime parameter
262
+ |
263
+ LL | fn g<'a>(mut x: impl Foo<'a>) -> Option<&()> { x.next() }
264
+ | ++++ ++
265
+
266
+ error[E0658]: anonymous lifetimes in `impl Trait` are unstable
267
+ --> $DIR/impl-trait-missing-lifetime-gated.rs:66:22
268
+ |
222
269
LL | fn f(_: impl Foo<()>) {}
223
270
| ^ expected named lifetime parameter
224
271
|
@@ -230,7 +277,7 @@ LL | fn f<'a>(_: impl Foo<'a, ()>) {}
230
277
| ++++ +++
231
278
232
279
error[E0658]: anonymous lifetimes in `impl Trait` are unstable
233
- --> $DIR/impl-trait-missing-lifetime-gated.rs:58 :26
280
+ --> $DIR/impl-trait-missing-lifetime-gated.rs:69 :26
234
281
|
235
282
LL | fn g(mut x: impl Foo<()>) -> Option<&()> { x.next() }
236
283
| ^ expected named lifetime parameter
@@ -242,7 +289,7 @@ help: consider introducing a named lifetime parameter
242
289
LL | fn g<'a>(mut x: impl Foo<'a, ()>) -> Option<&()> { x.next() }
243
290
| ++++ +++
244
291
245
- error: aborting due to 14 previous errors; 1 warning emitted
292
+ error: aborting due to 17 previous errors; 1 warning emitted
246
293
247
294
Some errors have detailed explanations: E0106, E0658.
248
295
For more information about an error, try `rustc --explain E0106`.
0 commit comments