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

Improve diagnostic for missing half of binary operator in if condition #91435

Merged
merged 1 commit into from
Dec 3, 2021

Conversation

FabianWolff
Copy link
Contributor

Fixes #91421. I've also changed it so that it doesn't consume the else token in the error case, because it will try to consume it again afterwards, leading to this incorrect error message (where the else reported as missing is actually there):

error: expected one of `.`, `;`, `?`, `else`, or an operator, found `{`
 --> src/main.rs:4:12
  |
4 |     } else { 4 };
  |            ^ expected one of `.`, `;`, `?`, `else`, or an operator

r? @lcnr

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Dec 1, 2021
@apiraino apiraino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Dec 1, 2021
@lcnr
Copy link
Contributor

lcnr commented Dec 2, 2021

lgtm 👍 thanks

@bors r+

@bors
Copy link
Contributor

bors commented Dec 2, 2021

📌 Commit ba7374e has been approved by lcnr

@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 2, 2021
bors added a commit to rust-lang-ci/rust that referenced this pull request Dec 2, 2021
…askrgr

Rollup of 12 pull requests

Successful merges:

 - rust-lang#89954 (Fix legacy_const_generic doc arguments display)
 - rust-lang#91321 (Handle placeholder regions in NLL type outlive constraints)
 - rust-lang#91329 (Fix incorrect usage of `EvaluatedToOk` when evaluating `TypeOutlives`)
 - rust-lang#91364 (Improve error message for incorrect field accesses through raw pointers)
 - rust-lang#91387 (Clarify and tidy up explanation of E0038)
 - rust-lang#91410 (Move `#![feature(const_precise_live_drops)]` checks earlier in the pipeline)
 - rust-lang#91435 (Improve diagnostic for missing half of binary operator in `if` condition)
 - rust-lang#91444 (disable tests in Miri that take too long)
 - rust-lang#91457 (Add additional test from rust issue number 91068)
 - rust-lang#91460 (Document how `last_os_error` should be used)
 - rust-lang#91464 (Document file path case sensitivity)
 - rust-lang#91466 (Improve the comments in `Symbol::interner`.)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit dbb9e22 into rust-lang:master Dec 3, 2021
@rustbot rustbot added this to the 1.59.0 milestone Dec 3, 2021
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. 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.

Poor diagnostic when using an if expression with missing half of binary operator
6 participants