Closed
Description
The code
struct S<'a>(&'a ());
fn f(s: S<'_>) -> _ {
s
}
Emits this diagnostic, which is wrong in this case.
error[E0121]: the placeholder `_` is not allowed within types on item signatures for return types
--> src/lib.rs:2:19
|
2 | fn f(s: S<'_>) -> _ {
| ^
| |
| not allowed in type signatures
| help: replace with the correct return type: `S<'static>`
For more information about this error, try `rustc --explain E0121`.
It should say help: replace with the correct return type: S<'_>
cc: rust-lang/rust-analyzer#16676
Activity
jieyouxu commentedon May 24, 2024
jieyouxu commentedon May 24, 2024
Did you mean to write this code snippet instead?
oriongonza commentedon May 24, 2024
Ooops yes 😅, edited
surechen commentedon May 30, 2024
@rustbot claim
Fix a error suggestion of situation when using placeholder `_` as ret…
_
as return types on function signature. #126017Fix a error suggestion of situation when using placeholder `_` as ret…
4 remaining items