mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
Auto merge of #16349 - Young-Flash:use_error_recovery, r=Veykril
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  after  close https://github.com/rust-lang/rust-analyzer/issues/16227
This commit is contained in:
commit
1ab8c7fd27
5 changed files with 112 additions and 38 deletions
|
@ -20,32 +20,21 @@ SOURCE_FILE
|
|||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "Error"
|
||||
ERROR
|
||||
SEMICOLON ";"
|
||||
WHITESPACE "\n"
|
||||
ERROR
|
||||
USE_KW "use"
|
||||
WHITESPACE " "
|
||||
USE_TREE
|
||||
PATH
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "std"
|
||||
COLON2 "::"
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "io"
|
||||
ERROR
|
||||
SEMICOLON ";"
|
||||
SEMICOLON ";"
|
||||
WHITESPACE "\n"
|
||||
error 22: expected COMMA
|
||||
error 22: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
|
||||
error 23: expected COMMA
|
||||
error 24: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
|
||||
error 27: expected COMMA
|
||||
error 35: expected COMMA
|
||||
error 35: expected one of `*`, `::`, `{`, `self`, `super` or an identifier
|
||||
error 36: expected COMMA
|
||||
error 36: expected R_CURLY
|
||||
error 36: expected SEMICOLON
|
||||
USE
|
||||
USE_KW "use"
|
||||
WHITESPACE " "
|
||||
USE_TREE
|
||||
PATH
|
||||
PATH
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "std"
|
||||
COLON2 "::"
|
||||
PATH_SEGMENT
|
||||
NAME_REF
|
||||
IDENT "io"
|
||||
SEMICOLON ";"
|
||||
WHITESPACE "\n"
|
||||
error 22: expected R_CURLY
|
||||
|
|
|
@ -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
|
|
@ -0,0 +1,4 @@
|
|||
use {a;
|
||||
use b;
|
||||
struct T;
|
||||
fn test() {}
|
Loading…
Add table
Add a link
Reference in a new issue