diff options
author | Aleksey Kladov <[email protected]> | 2019-09-05 17:53:07 +0100 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2019-09-05 17:53:07 +0100 |
commit | b2be998b7b0beb48806cd3a1552e44100b12ddb6 (patch) | |
tree | c9221ae272d625fce3751e86afe21e6a623e3b71 /crates/ra_parser/src | |
parent | edc2016f8b49964fa5b179c1ed8e12e4e0a39702 (diff) |
better error recovery for use trees
Diffstat (limited to 'crates/ra_parser/src')
-rw-r--r-- | crates/ra_parser/src/grammar/items.rs | 2 | ||||
-rw-r--r-- | crates/ra_parser/src/grammar/items/use_item.rs | 5 |
2 files changed, 5 insertions, 2 deletions
diff --git a/crates/ra_parser/src/grammar/items.rs b/crates/ra_parser/src/grammar/items.rs index 6d426206e..b4327b78f 100644 --- a/crates/ra_parser/src/grammar/items.rs +++ b/crates/ra_parser/src/grammar/items.rs | |||
@@ -31,7 +31,7 @@ pub(super) enum ItemFlavor { | |||
31 | 31 | ||
32 | pub(super) const ITEM_RECOVERY_SET: TokenSet = token_set![ | 32 | pub(super) const ITEM_RECOVERY_SET: TokenSet = token_set![ |
33 | FN_KW, STRUCT_KW, ENUM_KW, IMPL_KW, TRAIT_KW, CONST_KW, STATIC_KW, LET_KW, MOD_KW, PUB_KW, | 33 | FN_KW, STRUCT_KW, ENUM_KW, IMPL_KW, TRAIT_KW, CONST_KW, STATIC_KW, LET_KW, MOD_KW, PUB_KW, |
34 | CRATE_KW | 34 | CRATE_KW, USE_KW |
35 | ]; | 35 | ]; |
36 | 36 | ||
37 | pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool, flavor: ItemFlavor) { | 37 | pub(super) fn item_or_macro(p: &mut Parser, stop_on_r_curly: bool, flavor: ItemFlavor) { |
diff --git a/crates/ra_parser/src/grammar/items/use_item.rs b/crates/ra_parser/src/grammar/items/use_item.rs index c0c7d0ec6..83a65e226 100644 --- a/crates/ra_parser/src/grammar/items/use_item.rs +++ b/crates/ra_parser/src/grammar/items/use_item.rs | |||
@@ -101,7 +101,10 @@ fn use_tree(p: &mut Parser) { | |||
101 | } | 101 | } |
102 | _ => { | 102 | _ => { |
103 | m.abandon(p); | 103 | m.abandon(p); |
104 | p.err_and_bump("expected one of `*`, `::`, `{`, `self`, `super` or an indentifier"); | 104 | p.err_recover( |
105 | "expected one of `*`, `::`, `{`, `self`, `super` or an identifier", | ||
106 | ITEM_RECOVERY_SET, | ||
107 | ); | ||
105 | return; | 108 | return; |
106 | } | 109 | } |
107 | } | 110 | } |