aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_parser
diff options
context:
space:
mode:
authorLaurenČ›iu Nicola <[email protected]>2020-06-23 07:41:43 +0100
committerLaurenČ›iu Nicola <[email protected]>2020-06-23 14:51:07 +0100
commit76ddface089886c88b8b29e3893119f38ef26aab (patch)
tree9df8e5f774a385d64669f3883a9fef1b6aebb9a2 /crates/ra_parser
parent98c3e4e887dcc5a8242c3e67c04a3cedbb1b9c58 (diff)
Fix panic in split and merge import assists
Diffstat (limited to 'crates/ra_parser')
-rw-r--r--crates/ra_parser/src/grammar/paths.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/crates/ra_parser/src/grammar/paths.rs b/crates/ra_parser/src/grammar/paths.rs
index 428aa711e..fd51189d5 100644
--- a/crates/ra_parser/src/grammar/paths.rs
+++ b/crates/ra_parser/src/grammar/paths.rs
@@ -73,8 +73,10 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
73 } 73 }
74 p.expect(T![>]); 74 p.expect(T![>]);
75 } else { 75 } else {
76 let mut empty = true;
76 if first { 77 if first {
77 p.eat(T![::]); 78 p.eat(T![::]);
79 empty = false;
78 } 80 }
79 match p.current() { 81 match p.current() {
80 IDENT => { 82 IDENT => {
@@ -86,6 +88,12 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
86 T![self] | T![super] | T![crate] => p.bump_any(), 88 T![self] | T![super] | T![crate] => p.bump_any(),
87 _ => { 89 _ => {
88 p.err_recover("expected identifier", items::ITEM_RECOVERY_SET); 90 p.err_recover("expected identifier", items::ITEM_RECOVERY_SET);
91 if empty {
92 // test_err empty_segment
93 // use crate::;
94 m.abandon(p);
95 return;
96 }
89 } 97 }
90 }; 98 };
91 } 99 }