mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 04:48:13 +00:00
Improve error handling for top-level let statements
This commit addresses the issue of excessive and unrelated errors generated by top-level `let` statements. Now, only a single error is produced, indicating that `let` statements are invalid at the top level.
This commit is contained in:
parent
c9d189d137
commit
e076192dd8
5 changed files with 86 additions and 44 deletions
|
|
@ -0,0 +1,30 @@
|
|||
SOURCE_FILE
|
||||
ERROR
|
||||
LET_KW "let"
|
||||
WHITESPACE " "
|
||||
IDENT_PAT
|
||||
REF_KW "ref"
|
||||
WHITESPACE " "
|
||||
NAME
|
||||
IDENT "foo"
|
||||
COLON ":"
|
||||
WHITESPACE " "
|
||||
FN_PTR_TYPE
|
||||
FN_KW "fn"
|
||||
PARAM_LIST
|
||||
L_PAREN "("
|
||||
R_PAREN ")"
|
||||
WHITESPACE " "
|
||||
EQ "="
|
||||
WHITESPACE " "
|
||||
BIN_EXPR
|
||||
LITERAL
|
||||
INT_NUMBER "1"
|
||||
WHITESPACE " "
|
||||
PLUS "+"
|
||||
WHITESPACE " "
|
||||
LITERAL
|
||||
INT_NUMBER "3"
|
||||
SEMICOLON ";"
|
||||
WHITESPACE "\n"
|
||||
error 0: expected an item
|
||||
|
|
@ -0,0 +1 @@
|
|||
let ref foo: fn() = 1 + 3;
|
||||
Loading…
Add table
Add a link
Reference in a new issue