Skip to content
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

GRAM: pin the fn keyword in FnPointer #7664

Merged
merged 1 commit into from Aug 12, 2021
Merged

GRAM: pin the fn keyword in FnPointer #7664

merged 1 commit into from Aug 12, 2021

Conversation

afetisov
Copy link
Contributor

Pin fn keyword in function pointer types to improve error recovery.

@vlad20012
Copy link
Member

vlad20012 commented Aug 11, 2021

I'm trying to remember why I didn't pin fn pointer when I pin other types (#5050). I think, the reason is this case:

fn foo() -> // caret; a user is typing here

fn bar() {}

An incomplete foo declaration shouldn't break fn bar, I guess.
I think this case can be covered by this grammar:

FnPointerType ::= [ unsafe? ExternAbi? ] fn !identifier FnTypeParameters RetType? {
  pin = 3

@afetisov
Copy link
Contributor Author

Nice catch, I'll add it to the tests.

@vlad20012
Copy link
Member

bors r+

bors bot added a commit that referenced this pull request Aug 11, 2021
7664: GRAM: pin the `fn` keyword in FnPointer r=vlad20012 a=afetisov

Pin `fn` keyword in function pointer types to improve error recovery.

Co-authored-by: Anton Fetisov <fetisov.anton.u@gmail.com>
@vlad20012 vlad20012 self-assigned this Aug 11, 2021
@vlad20012
Copy link
Member

bors r-

@bors
Copy link
Contributor

bors bot commented Aug 11, 2021

Canceled.

Copy link
Member

@vlad20012 vlad20012 left a comment

Choose a reason for hiding this comment

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

bors r+

@bors
Copy link
Contributor

bors bot commented Aug 12, 2021

Build succeeded:

@bors bors bot merged commit 4fab5d2 into intellij-rust:master Aug 12, 2021
@github-actions github-actions bot added this to the v154 milestone Aug 12, 2021
@afetisov afetisov deleted the pin-fn-type branch February 3, 2022 02:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants