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

Do not add ; to expected tokens list when it's wrong #91531

Merged

Conversation

notriddle
Copy link
Contributor

There's a few spots where semicolons are checked for to do error recovery, and should not be suggested (or checked for other stuff).

Fixes #87647

There's a few spots where semicolons are checked for to do error recovery,
and should not be suggested (or checked for other stuff).

Fixes rust-lang#87647
@rust-highfive
Copy link
Collaborator

r? @michaelwoerister

(rust-highfive has picked a reviewer for you, use r? to override)

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 4, 2021
@michaelwoerister
Copy link
Member

r? rust-lang/diagnostics

Also add a test case for inserting a semicolon on extern fns.

Without this fix, we got an error like this:

    error: expected one of `->`, `where`, or `{`, found `}`
     --> chk.rs:3:1
      |
    2 |   fn foo()
      |      ---  - expected one of `->`, `where`, or `{`
      |      |
      |      while parsing this `fn`
    3 | }
      | ^ unexpected token

Since this is inside an extern block, you're required to write function
prototypes with no body. This fixes a regression, and adds a test case
for it.
@notriddle notriddle force-pushed the notriddle/issue-87647-expected-semicolon branch from d239703 to 6611567 Compare December 6, 2021 18:20
@estebank
Copy link
Contributor

estebank commented Dec 7, 2021

@bors r+

@bors
Copy link
Contributor

bors commented Dec 7, 2021

📌 Commit 6611567 has been approved by estebank

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 7, 2021
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 7, 2021
…ected-semicolon, r=estebank

Do not add `;` to expected tokens list when it's wrong

There's a few spots where semicolons are checked for to do error recovery, and should not be suggested (or checked for other stuff).

Fixes rust-lang#87647
matthiaskrgr added a commit to matthiaskrgr/rust that referenced this pull request Dec 8, 2021
…ected-semicolon, r=estebank

Do not add `;` to expected tokens list when it's wrong

There's a few spots where semicolons are checked for to do error recovery, and should not be suggested (or checked for other stuff).

Fixes rust-lang#87647
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 8, 2021
…askrgr

Rollup of 7 pull requests

Successful merges:

 - rust-lang#83744 (Deprecate crate_type and crate_name nested inside #![cfg_attr])
 - rust-lang#90550 (Update certificates in some Ubuntu 16 images.)
 - rust-lang#91272 (Print a suggestion when comparing references to primitive types in `const fn`)
 - rust-lang#91467 (Emphasise that an OsStr[ing] is not necessarily a platform string)
 - rust-lang#91531 (Do not add `;` to expected tokens list when it's wrong)
 - rust-lang#91577 (Address some FIXMEs left over from rust-lang#91475)
 - rust-lang#91638 (Remove `in_band_lifetimes` from `rustc_mir_transform`)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 87f2c51 into rust-lang:master Dec 8, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 8, 2021
@notriddle notriddle deleted the notriddle/issue-87647-expected-semicolon branch December 8, 2021 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Parser incorrectly suggests adding semicolon after function in impl
6 participants