5

Improve diagnostic for missing half of binary operator in `if` condition by Fabi...

 2 years ago
source link: https://github.com/rust-lang/rust/pull/91435
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Copy link

Contributor

FabianWolff commented 8 days ago

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


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK