许杰友 Jieyou Xu (Joe) 2f62fd3d13
Rollup merge of #133051 - estebank:cond-misparse, r=jieyouxu
Increase accuracy of `if` condition misparse suggestion

Fix #132656.

Look at the expression that was parsed when trying to recover from a bad `if` condition to determine what was likely intended by the user beyond "maybe this was meant to be an `else` body".

```
error: expected `{`, found `map`
  --> $DIR/missing-dot-on-if-condition-expression-fixable.rs:4:30
   |
LL |     for _ in [1, 2, 3].iter()map(|x| x) {}
   |                              ^^^ expected `{`
   |
help: you might have meant to write a method call
   |
LL |     for _ in [1, 2, 3].iter().map(|x| x) {}
   |                              +
```

If a macro statement has been parsed after `else`, suggest a missing `if`:

```
error: expected `{`, found `falsy`
  --> $DIR/else-no-if.rs:47:12
   |
LL |     } else falsy! {} {
   |       ---- ^^^^^
   |       |
   |       expected an `if` or a block after this `else`
   |
help: add an `if` if this is the condition of a chained `else if` statement
   |
LL |     } else if falsy! {} {
   |            ++
```
2024-11-17 23:56:08 +08:00
..
2024-08-03 07:57:31 -04:00
2024-05-15 13:17:11 -05:00
2024-04-24 13:12:33 +01:00
2024-04-24 13:12:33 +01:00
2024-04-22 18:48:47 +02:00
2024-11-16 20:03:31 +00:00
2024-09-23 12:55:56 -04:00
2024-06-25 17:22:22 +02:00
2024-06-25 17:22:22 +02:00