forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#16349 - Young-Flash:use_error_recovery, r=Vey…
…kril fix: add error recovery for use_tree_list parsing This PR adds error recovery for USE_TREE_LIST parsing, avoid the wrong USE_TREE_LIST making the rest parsing incorrectly. before ![before](https://github.com/rust-lang/rust-analyzer/assets/71162630/c6643690-f25c-4ad9-93d9-e661ba5b1dc3) after ![after](https://github.com/rust-lang/rust-analyzer/assets/71162630/30a58c40-2711-48d2-b2e5-fb208fc8636c) close rust-lang/rust-analyzer#16227
- Loading branch information
Showing
5 changed files
with
112 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
crates/parser/test_data/parser/inline/err/0026_use_tree_list_err_recovery.rast
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
SOURCE_FILE | ||
USE | ||
USE_KW "use" | ||
WHITESPACE " " | ||
USE_TREE | ||
USE_TREE_LIST | ||
L_CURLY "{" | ||
USE_TREE | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "a" | ||
SEMICOLON ";" | ||
WHITESPACE "\n" | ||
USE | ||
USE_KW "use" | ||
WHITESPACE " " | ||
USE_TREE | ||
PATH | ||
PATH_SEGMENT | ||
NAME_REF | ||
IDENT "b" | ||
SEMICOLON ";" | ||
WHITESPACE "\n" | ||
STRUCT | ||
STRUCT_KW "struct" | ||
WHITESPACE " " | ||
NAME | ||
IDENT "T" | ||
SEMICOLON ";" | ||
WHITESPACE "\n" | ||
FN | ||
FN_KW "fn" | ||
WHITESPACE " " | ||
NAME | ||
IDENT "test" | ||
PARAM_LIST | ||
L_PAREN "(" | ||
R_PAREN ")" | ||
WHITESPACE " " | ||
BLOCK_EXPR | ||
STMT_LIST | ||
L_CURLY "{" | ||
R_CURLY "}" | ||
WHITESPACE "\n" | ||
error 6: expected R_CURLY |
4 changes: 4 additions & 0 deletions
4
crates/parser/test_data/parser/inline/err/0026_use_tree_list_err_recovery.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
use {a; | ||
use b; | ||
struct T; | ||
fn test() {} |