mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 05:15:04 +00:00
Fix panic in split and merge import assists
This commit is contained in:
parent
98c3e4e887
commit
76ddface08
7 changed files with 49 additions and 4 deletions
|
@ -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;
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue