Skip to content

Commit ef462ed

Browse files
committed
Better recovery in use foo::;
1 parent 0e1cda3 commit ef462ed

File tree

2 files changed

+17
-7
lines changed

2 files changed

+17
-7
lines changed

crates/parser/src/grammar/items.rs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,20 @@ pub(super) fn mod_contents(p: &mut Parser, stop_on_r_curly: bool) {
2727
}
2828

2929
pub(super) const ITEM_RECOVERY_SET: TokenSet = token_set![
30-
FN_KW, STRUCT_KW, ENUM_KW, IMPL_KW, TRAIT_KW, CONST_KW, STATIC_KW, LET_KW, MOD_KW, PUB_KW,
31-
CRATE_KW, USE_KW, MACRO_KW
30+
FN_KW,
31+
STRUCT_KW,
32+
ENUM_KW,
33+
IMPL_KW,
34+
TRAIT_KW,
35+
CONST_KW,
36+
STATIC_KW,
37+
LET_KW,
38+
MOD_KW,
39+
PUB_KW,
40+
CRATE_KW,
41+
USE_KW,
42+
MACRO_KW,
43+
T![;],
3244
];
3345

3446
pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool) {

crates/syntax/test_data/parser/inline/err/0015_empty_segment.rast

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ [email protected]
22
33
44
5-
USE_TREE@4..12
6-
PATH@4..12
5+
USE_TREE@4..11
6+
PATH@4..11
77
88
99
1010
11-
12-
11+
1312
1413
error 11..11: expected identifier
15-
error 12..12: expected SEMICOLON

0 commit comments

Comments
 (0)