-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Wrong diagnostic when returning _
with a lifetime
#125488
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
D-incorrect
Diagnostics: A diagnostic that is giving misleading or incorrect information.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
Comments
rustbot
added
the
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
label
May 24, 2024
This comment was marked as resolved.
This comment was marked as resolved.
Did you mean to write this code snippet instead?
|
Ooops yes 😅, edited |
jieyouxu
added
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
D-incorrect
Diagnostics: A diagnostic that is giving misleading or incorrect information.
and removed
needs-triage
This issue may need triage. Remove it if it has been sufficiently triaged.
labels
May 24, 2024
@rustbot claim |
surechen
added a commit
to surechen/rust
that referenced
this issue
Jun 5, 2024
…urn types on function signature. fixes rust-lang#125488
surechen
added a commit
to surechen/rust
that referenced
this issue
Jun 25, 2024
…urn types on function signature. fixes rust-lang#125488
matthiaskrgr
added a commit
to matthiaskrgr/rust
that referenced
this issue
Jun 29, 2024
…-errors Fix a error suggestion for E0121 when using placeholder _ as return types on function signature. Recommit after refactoring based on comment: rust-lang#126017 (comment) But when changing return type's lifetime to `ReError` will affect the subsequent borrow check process and cause test11 in typeck_type_placeholder_item.rs to lost E0515 message. ```rust fn test11(x: &usize) -> &_ { //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types &x //~ ERROR cannot return reference to function parameter(this E0515 msg will disappear) } ``` fixes rust-lang#125488 r? `@pnkfelix`
rust-timer
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jun 30, 2024
Rollup merge of rust-lang#127110 - surechen:fix_125488_06, r=compiler-errors Fix a error suggestion for E0121 when using placeholder _ as return types on function signature. Recommit after refactoring based on comment: rust-lang#126017 (comment) But when changing return type's lifetime to `ReError` will affect the subsequent borrow check process and cause test11 in typeck_type_placeholder_item.rs to lost E0515 message. ```rust fn test11(x: &usize) -> &_ { //~^ ERROR the placeholder `_` is not allowed within types on item signatures for return types &x //~ ERROR cannot return reference to function parameter(this E0515 msg will disappear) } ``` fixes rust-lang#125488 r? ``@pnkfelix``
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
A-diagnostics
Area: Messages for errors, warnings, and lints
A-lifetimes
Area: Lifetimes / regions
D-incorrect
Diagnostics: A diagnostic that is giving misleading or incorrect information.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
The code
Emits this diagnostic, which is wrong in this case.
It should say
help: replace with the correct return type: S<'_>
cc: rust-lang/rust-analyzer#16676
The text was updated successfully, but these errors were encountered: