This repository was archived by the owner on May 28, 2025. It is now read-only.
Commit 0a579d5
authored
Rollup merge of rust-lang#138749 - compiler-errors:closure-recovery, r=fmease
Fix closure recovery for missing block when return type is specified
Firstly, fix the `is_array_like_block` condition to make sure we're actually recovering a mistyped *block* rather than some other delimited expression. This fixes rust-lang#138748.
Secondly, split out the recovery of missing braces on a closure body into a separate recovery. Right now, the suggestion `"you might have meant to write this as part of a block"` originates from `suggest_fixes_misparsed_for_loop_head`, which feels kinda brittle and coincidental since AFAICT that recovery wasn't ever really intended to fix this.
We also can make this `MachineApplicable` in this case.
Fixes rust-lang#138748
r? `@fmease` or reassign if you're busy/don't wanna review thisFile tree
4 files changed
+101
-16
lines changed- compiler/rustc_parse/src
- parser
- tests/ui/parser
4 files changed
+101
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
810 | 810 | | |
811 | 811 | | |
812 | 812 | | |
813 | | - | |
| 813 | + | |
814 | 814 | | |
815 | 815 | | |
816 | 816 | | |
817 | | - | |
| 817 | + | |
818 | 818 | | |
819 | 819 | | |
820 | 820 | | |
821 | 821 | | |
822 | | - | |
| 822 | + | |
823 | 823 | | |
824 | 824 | | |
825 | 825 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2200 | 2200 | | |
2201 | 2201 | | |
2202 | 2202 | | |
2203 | | - | |
| 2203 | + | |
| 2204 | + | |
| 2205 | + | |
2204 | 2206 | | |
2205 | 2207 | | |
2206 | 2208 | | |
| |||
2212 | 2214 | | |
2213 | 2215 | | |
2214 | 2216 | | |
2215 | | - | |
| 2217 | + | |
2216 | 2218 | | |
2217 | | - | |
| 2219 | + | |
2218 | 2220 | | |
2219 | 2221 | | |
2220 | 2222 | | |
| |||
2337 | 2339 | | |
2338 | 2340 | | |
2339 | 2341 | | |
2340 | | - | |
| 2342 | + | |
| 2343 | + | |
2341 | 2344 | | |
2342 | 2345 | | |
2343 | 2346 | | |
| |||
2349 | 2352 | | |
2350 | 2353 | | |
2351 | 2354 | | |
2352 | | - | |
2353 | | - | |
2354 | | - | |
2355 | | - | |
2356 | | - | |
| 2355 | + | |
| 2356 | + | |
2357 | 2357 | | |
2358 | 2358 | | |
2359 | 2359 | | |
| |||
2405 | 2405 | | |
2406 | 2406 | | |
2407 | 2407 | | |
| 2408 | + | |
| 2409 | + | |
| 2410 | + | |
| 2411 | + | |
| 2412 | + | |
| 2413 | + | |
| 2414 | + | |
| 2415 | + | |
| 2416 | + | |
| 2417 | + | |
| 2418 | + | |
| 2419 | + | |
| 2420 | + | |
| 2421 | + | |
| 2422 | + | |
| 2423 | + | |
| 2424 | + | |
| 2425 | + | |
| 2426 | + | |
| 2427 | + | |
| 2428 | + | |
| 2429 | + | |
| 2430 | + | |
| 2431 | + | |
| 2432 | + | |
| 2433 | + | |
| 2434 | + | |
| 2435 | + | |
| 2436 | + | |
| 2437 | + | |
| 2438 | + | |
| 2439 | + | |
| 2440 | + | |
| 2441 | + | |
| 2442 | + | |
| 2443 | + | |
| 2444 | + | |
| 2445 | + | |
| 2446 | + | |
| 2447 | + | |
| 2448 | + | |
| 2449 | + | |
| 2450 | + | |
2408 | 2451 | | |
2409 | 2452 | | |
2410 | 2453 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
6 | 8 | | |
7 | | - | |
| 9 | + | |
8 | 10 | | |
9 | 11 | | |
10 | 12 | | |
11 | 13 | | |
12 | | - | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
13 | 41 | | |
0 commit comments