Fix panic in split and merge import assists

This commit is contained in:
Laurențiu Nicola 2020-06-23 09:41:43 +03:00
parent 98c3e4e887
commit 76ddface08
7 changed files with 49 additions and 4 deletions

View file

@ -73,8 +73,10 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
}
p.expect(T![>]);
} else {
let mut empty = true;
if first {
p.eat(T![::]);
empty = false;
}
match p.current() {
IDENT => {
@ -86,6 +88,12 @@ fn path_segment(p: &mut Parser, mode: Mode, first: bool) {
T![self] | T![super] | T![crate] => p.bump_any(),
_ => {
p.err_recover("expected identifier", items::ITEM_RECOVERY_SET);
if empty {
// test_err empty_segment
// use crate::;
m.abandon(p);
return;
}
}
};
}