Commit 9ab05b4
authored
Rollup merge of rust-lang#81876 - osa1:issue81806, r=matthewjasper
parser: Fix panic in 'const impl' recovery
The panic happens when in recovery parsing a full `impl`
(`parse_item_impl`) fails and we drop the `DiagnosticBuilder` for the
recovery suggestion and return the `parse_item_impl` error.
We now raise the original error "expected identifier found `impl`" when
parsing the `impl` fails.
Note that the regression test is slightly simplified version of the
original repro in rust-lang#81806, to make the error output smaller and more
resilient to unrelated changes in parser error messages.
Fixes rust-lang#81806File tree
3 files changed
+34
-2
lines changed- compiler/rustc_parse/src/parser
- src/test/ui/parser
3 files changed
+34
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1010 | 1010 | | |
1011 | 1011 | | |
1012 | 1012 | | |
1013 | | - | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
1014 | 1024 | | |
1015 | | - | |
1016 | 1025 | | |
1017 | 1026 | | |
1018 | 1027 | | |
| |||
1030 | 1039 | | |
1031 | 1040 | | |
1032 | 1041 | | |
| 1042 | + | |
1033 | 1043 | | |
1034 | 1044 | | |
1035 | 1045 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
0 commit comments