许杰友 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-10-18 18:18:41 +02:00
2024-10-28 14:16:05 +03:00
2024-08-03 07:57:31 -04:00
2024-09-06 17:06:35 +03:00
2024-09-25 13:26:48 +02:00
2024-09-27 14:29:34 -07:00
2024-10-28 16:57:08 +11:00
2024-09-26 10:18:18 +08:00
2024-08-18 20:32:04 +03:00
2024-11-01 16:07:02 +01:00
2024-10-29 16:40:06 -07:00
2024-09-14 16:12:00 +05:30
2024-07-23 00:29:39 -03:00
2024-11-14 09:08:56 +08:00
2024-07-31 00:07:42 -04:00
2024-05-21 20:16:39 +00:00
2024-09-25 13:26:48 +02:00
2024-09-27 16:37:43 +08:00
2024-09-27 16:37:43 +08:00
2024-09-13 11:51:17 +02:00
2024-09-13 11:51:17 +02:00
2024-09-13 11:51:17 +02:00
2024-10-31 10:55:45 +01:00
2024-10-31 10:55:45 +01:00
2024-10-31 10:55:45 +01:00
2024-08-31 14:00:54 +00:00
2024-08-08 13:09:58 +00:00
2024-10-18 18:18:41 +02:00
2024-10-18 18:18:41 +02:00
2024-10-18 18:18:41 +02:00
2024-10-18 18:18:41 +02:00
2024-05-24 19:31:57 +08:00
2024-05-24 19:31:57 +08:00
2024-05-24 19:31:57 +08:00
2024-05-24 19:31:57 +08:00
2024-05-24 19:31:57 +08:00
2024-08-22 13:32:01 +02:00
2024-08-22 13:32:01 +02:00
2024-08-22 13:32:01 +02:00
2024-05-29 17:40:34 +08:00
2024-05-29 16:53:28 +08:00
2024-05-29 16:53:28 +08:00
2024-05-29 16:53:28 +08:00
2024-05-29 16:53:28 +08:00
2024-06-25 17:22:22 +02:00
2024-11-03 13:55:52 -08:00
2024-11-03 13:55:52 -08:00
2024-06-25 22:32:46 +02:00
2024-06-25 22:32:46 +02:00
2024-09-06 20:51:06 +00:00
2024-09-21 09:51:14 -07:00
2024-09-21 09:51:14 -07:00
2024-05-15 13:17:11 -05:00
2024-05-15 13:17:11 -05:00
2024-10-18 18:18:41 +02:00
2024-10-18 18:18:41 +02:00
2024-10-18 18:18:41 +02:00
2024-05-29 16:53:37 +08:00
2024-05-29 16:53:37 +08:00
2024-05-29 16:53:37 +08:00
2024-05-29 17:40:34 +08:00
2024-05-29 17:40:34 +08:00
2024-05-29 17:40:34 +08:00
2024-05-29 17:40:34 +08:00
2024-05-29 17:40:34 +08:00
2024-05-29 17:40:34 +08:00
2024-05-20 19:55:59 -07:00
2024-05-20 19:55:59 -07:00
2024-08-08 13:09:58 +00:00
2024-04-29 08:16:26 +05:30
2024-04-29 08:16:26 +05:30
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-10-31 21:26:36 -05:00
2024-10-31 21:26:36 -05:00
2024-10-31 21:26:36 -05:00
2024-10-31 21:26:36 -05:00
2024-10-31 21:26:36 -05:00
2024-08-16 14:10:06 -04:00
2024-08-19 21:39:57 +02:00
2024-10-18 18:18:41 +02:00
2024-10-18 18:18:41 +02:00
2024-11-16 20:03:31 +00:00
2024-07-18 20:08:38 +00:00
2024-11-02 03:08:04 +00:00
2024-08-16 14:10:06 -04:00
2024-08-06 13:56:59 +00:00
2024-08-06 13:56:59 +00:00
2024-10-19 13:01:30 -07:00
2024-10-19 13:01:30 -07:00
2024-09-23 12:55:56 -04:00
2024-10-06 22:36:51 -04:00
2024-10-06 22:36:51 -04:00
2024-06-21 19:00:18 -04:00
2024-09-09 14:51:39 +02:00
2024-09-09 14:51:39 +02:00
2024-10-23 18:05:27 +00:00
2024-09-11 12:14:35 +02:00
2024-08-16 14:10:06 -04:00
2024-11-03 13:55:52 -08:00
2024-07-11 12:23:44 +10:00
2024-08-31 14:00:54 +00:00
2024-08-31 14:00:54 +00:00
2024-08-31 14:00:54 +00:00
2024-08-31 14:00:54 +00:00
2024-11-03 13:55:52 -08:00
2024-11-03 13:55:52 -08:00
2024-11-03 13:55:52 -08:00
2024-11-03 13:55:52 -08:00
2024-11-03 13:55:52 -08:00
2024-10-21 15:22:17 +01:00
2024-10-21 15:22:17 +01:00
2024-07-07 17:11:05 +02:00
2024-07-07 17:11:05 +02:00
2024-08-31 14:00:54 +00:00
2024-08-31 14:00:54 +00:00
2024-08-31 14:00:54 +00:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-08-18 19:46:53 +02:00
2024-09-14 16:12:00 +05:30
2024-05-22 12:46:08 -04:00
2024-07-31 19:36:47 +02:00
2024-07-31 19:36:47 +02:00
2024-06-27 08:55:28 +10:00
2024-06-27 08:55:28 +10:00
2024-06-25 17:22:22 +02:00
2024-06-25 17:22:22 +02:00
2024-06-25 17:22:22 +02:00
2024-06-25 17:22:22 +02:00
2024-05-10 12:33:07 -04:00
2024-09-21 08:59:52 -07:00
2024-09-13 14:10:56 +03:00
2024-09-13 14:10:56 +03:00
2024-09-13 14:10:56 +03:00
2024-06-23 22:00:52 +00:00
2024-08-08 11:58:11 -04:00
2024-08-08 11:58:11 -04:00
2024-08-08 11:58:11 -04:00
2024-10-05 00:19:26 +00:00
2024-10-05 00:19:26 +00:00
2024-10-21 21:33:33 +08:00
2024-10-21 21:33:33 +08:00
2024-05-20 19:55:59 -07:00
2024-05-20 11:13:10 -04:00
2024-05-20 11:13:10 -04:00
2024-09-23 11:57:28 +02:00
2024-09-23 11:57:28 +02:00
2024-11-04 19:09:40 +01:00
2024-11-04 19:09:40 +01:00
2024-11-04 19:09:40 +01:00
2024-11-14 09:08:56 +08:00
2024-11-14 09:08:56 +08:00
2024-11-14 09:08:56 +08:00
2024-11-14 09:08:56 +08:00
2024-11-14 09:08:56 +08:00
2024-11-14 09:08:56 +08:00
2024-09-30 20:43:51 +03:00
2024-08-01 18:53:42 +00:00