about summary refs log tree commit diff
diff options
context:
space:
mode:
authorYoung-Flash <dongyang@apache.org>2024-01-12 17:41:46 +0800
committerYoung-Flash <dongyang@apache.org>2024-01-12 17:41:46 +0800
commitd0b310fc93c28611f8f13c22834aa48b99e77767 (patch)
tree1e8bfc8dc65ba675437b1467b1d1069aca42817c
parent45eea5711525ad19f8b6669f4e1317964efa4d8a (diff)
downloadrust-d0b310fc93c28611f8f13c22834aa48b99e77767.tar.gz
rust-d0b310fc93c28611f8f13c22834aa48b99e77767.zip
fix: add USE_TREE_LIST_FIRST_SET
-rw-r--r--crates/parser/src/grammar/items/use_item.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/crates/parser/src/grammar/items/use_item.rs b/crates/parser/src/grammar/items/use_item.rs
index b3974541735..f689c06b31c 100644
--- a/crates/parser/src/grammar/items/use_item.rs
+++ b/crates/parser/src/grammar/items/use_item.rs
@@ -78,7 +78,9 @@ fn use_tree(p: &mut Parser<'_>, top_level: bool) -> bool {
 }
 
 pub(super) const USE_TREE_LIST_RECOVERY_SET: TokenSet =
-    TokenSet::new(&[T![;], T![,], T![.], T![ident]]);
+    TokenSet::new(&[T![;], T![,], T![.], T![ident]]).union(ITEM_RECOVERY_SET);
+
+pub(super) const USE_TREE_LIST_FIRST_SET: TokenSet = TokenSet::new(&[T!['{'], T![ident]]);
 
 // test use_tree_list
 // use {a, b, c};
@@ -91,7 +93,7 @@ pub(crate) fn use_tree_list(p: &mut Parser<'_>) {
     // use b;
     // struct T;
     // fn test() {}
-    delimited(p, T!['{'], T!['}'], T![,], USE_TREE_LIST_RECOVERY_SET, |p: &mut Parser<'_>| {
+    delimited(p, T!['{'], T!['}'], T![,], USE_TREE_LIST_FIRST_SET, |p: &mut Parser<'_>| {
         use_tree(p, false) || p.at_ts(USE_TREE_LIST_RECOVERY_SET)
     });