Open
Description
Reproducer:
fn f() -> impl Sized + use<'_> {}
Current output:
error[E0106]: missing lifetime specifier
--> src/lib.rs:1:28
|
1 | fn f() -> impl Sized + use<'_> {}
| ^^ expected named lifetime parameter
|
= help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`, or if you will only have owned values
|
1 | fn f() -> impl Sized + use<'static> {}
| ~~~~~~~
error: expected lifetime parameter in `use<...>` precise captures list, found `'_`
--> src/lib.rs:1:28
|
1 | fn f() -> impl Sized + use<'_> {}
| ^^
Expected:
- Don't suggest
use<'static>
which is invalid - One diagnostic instead of two (while keeping the good hint this function's return type contains a borrowed value, but there is no value for it to be borrowed from)
Metadata
Metadata
Assignees
Labels
Area: Messages for errors, warnings, and lintsArea: Suggestions generated by the compiler applied by `cargo fix`Diagnostics: A structured suggestion resulting in incorrect code.Diagnostics: Too much output caused by a single piece of incorrect code.`#![feature(precise_capturing)]`Low priorityRelevant to the compiler team, which will review and decide on the PR/issue.