Commit a95a6e2
authored
Rollup merge of #54833 - abonander:issue-54441, r=petrochenkov
make `Parser::parse_foreign_item()` return a foreign item or error
Fixes `Parser::parse_foreign_item()` to follow the convention of `parse_trait_item()` and `parse_impl_item()` in that it *must* parse an item or return an error, and then the caller is responsible for detecting the closing delimiter.
This prevents it from looping endlessly on an unexpected token in `ext/expand.rs` where it was also leaking memory by continually pushing to `Parser::expected_tokens` via `Parser::check_keyword()`.
closes #54441
r? @petrochenkov
cc @dtolnayFile tree
5 files changed
+40
-16
lines changed- src
- libsyntax
- ext
- parse
- test
- parse-fail
- ui/macros
5 files changed
+40
-16
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1001 | 1001 | | |
1002 | 1002 | | |
1003 | 1003 | | |
1004 | | - | |
1005 | | - | |
1006 | | - | |
| 1004 | + | |
1007 | 1005 | | |
1008 | 1006 | | |
1009 | 1007 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6737 | 6737 | | |
6738 | 6738 | | |
6739 | 6739 | | |
6740 | | - | |
6741 | | - | |
| 6740 | + | |
| 6741 | + | |
6742 | 6742 | | |
6743 | | - | |
6744 | 6743 | | |
6745 | 6744 | | |
6746 | 6745 | | |
| |||
7324 | 7323 | | |
7325 | 7324 | | |
7326 | 7325 | | |
7327 | | - | |
7328 | | - | |
| 7326 | + | |
| 7327 | + | |
7329 | 7328 | | |
7330 | 7329 | | |
7331 | 7330 | | |
| |||
7345 | 7344 | | |
7346 | 7345 | | |
7347 | 7346 | | |
7348 | | - | |
| 7347 | + | |
7349 | 7348 | | |
7350 | 7349 | | |
7351 | 7350 | | |
7352 | | - | |
| 7351 | + | |
7353 | 7352 | | |
7354 | 7353 | | |
7355 | 7354 | | |
7356 | | - | |
| 7355 | + | |
7357 | 7356 | | |
7358 | 7357 | | |
7359 | 7358 | | |
7360 | 7359 | | |
7361 | | - | |
| 7360 | + | |
7362 | 7361 | | |
7363 | 7362 | | |
7364 | 7363 | | |
| |||
7367 | 7366 | | |
7368 | 7367 | | |
7369 | 7368 | | |
7370 | | - | |
| 7369 | + | |
7371 | 7370 | | |
7372 | 7371 | | |
7373 | | - | |
| 7372 | + | |
7374 | 7373 | | |
7375 | 7374 | | |
7376 | 7375 | | |
7377 | | - | |
| 7376 | + | |
7378 | 7377 | | |
7379 | 7378 | | |
7380 | 7379 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
0 commit comments