[WIP] Diagnose elision failure on the AST#96575
Closed
cjgillot wants to merge 12 commits intorust-lang:masterfrom
Closed
[WIP] Diagnose elision failure on the AST#96575cjgillot wants to merge 12 commits intorust-lang:masterfrom
cjgillot wants to merge 12 commits intorust-lang:masterfrom
Conversation
The extra diagnostics come from the compiler no longer aborting before typeck.
Contributor
|
r? @nagisa (rust-highfive has picked a reviewer for you, use r? to override) |
cjgillot
commented
Apr 30, 2022
Contributor
Author
cjgillot
commented
Apr 30, 2022
| visit::walk_ty(self, ty) | ||
| } | ||
| TyKind::ImplTrait(..) => { | ||
| if let AnonymousLifetimeRib::PassThrough(_) = |
Contributor
Author
There was a problem hiding this comment.
This will be corrected to a test on universal/existential impl-trait.
Collaborator
|
☔ The latest upstream changes (presumably #95776) made this pull request unmergeable. Please resolve the merge conflicts. |
Contributor
Author
|
Turns out this is not fully cooked yet. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Based on #95776 and #96559.
This PR moves the elision failure diagnostics ("expected named lifetime") from HIR to the AST.
This is is done by introducing a pair of functions
resolve_fn_like_elisionwhich handles ribs for functions andelision_lifetimewhich resolve parameters and return the proper lifetime for elision.I am not very confident in the elision logic: the currently implemented code allows a few more cases than is specified in the documentation. For instance, this is allowed:
This PR is WIP since its handling of impl-trait is a bit ad-hoc until #96529 is resolved.