Skip to content

Report "missing lifetime specifier" when an anonymous lifetime is used in bounds #96953

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

Closed
wants to merge 1 commit into from

Conversation

cjgillot
Copy link
Contributor

Both diagnostics pretty much do the same thing: report erroneous lifetime elision.

The "missing lifetime specifier" diagnostic has better diagnostics, as it suggests adding a named lifetime parameter.

This change does not accept more code, it just changes the diagnostic.

r? @petrochenkov

@rustbot rustbot added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label May 11, 2022
@rust-highfive
Copy link
Contributor

Some changes occurred in diagnostic error codes

cc @GuillaumeGomez

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label May 11, 2022
Copy link
Member

@GuillaumeGomez GuillaumeGomez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please don't remove error code explanations! There are examples where they are not emitted anymore. Please do the same for this error code as well.

@cjgillot
Copy link
Contributor Author

I don't understand your comment. The md file has been removed for other errors that are not emitted any more, hasn't it?

@GuillaumeGomez
Copy link
Member

It wasn't supposed to. I realized that a few months ago (maybe more than a year now, not sure...). The point is: if people with older rustc version look at newer rust error code page, they will not see their error anymore. Just update the md file like this one.

@GuillaumeGomez
Copy link
Member

Ah bingo, my CI check worked. :)

@GuillaumeGomez
Copy link
Member

Thanks! It's possible that the test will fail because of the compile_fail,E0106,E0637. If so, just update it to compile_fail,E0106 and it should work.

@petrochenkov
Copy link
Contributor

@cjgillot

This change does not accept more code, it just changes the diagnostic.

How it happens exactly? What serves as a replacement for AnonymousReportError?

@petrochenkov petrochenkov added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels May 13, 2022
@cjgillot
Copy link
Contributor Author

This was used for where predicates, and generic parameters. In these cases, there is no resolution for the elided lifetime, so we correctly print "missing lifetime specifier".
However, I forgot to account for universal impl-trait, where we need to explicitly forbid anonymous lifetimes, because purely syntactic rules would do the wrong thing.

@bors
Copy link
Collaborator

bors commented May 20, 2022

☔ The latest upstream changes (presumably #96833) made this pull request unmergeable. Please resolve the merge conflicts.

@cjgillot cjgillot closed this May 22, 2022
@cjgillot cjgillot deleted the no-e0637 branch May 22, 2022 10:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants