mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 20:09:19 +00:00
Recover better on missing parameter in param list
This commit is contained in:
parent
f19479a2ad
commit
a382e649ca
3 changed files with 50 additions and 1 deletions
|
@ -7,6 +7,9 @@ use super::*;
|
|||
// fn b(x: i32) {}
|
||||
// fn c(x: i32, ) {}
|
||||
// fn d(x: i32, y: ()) {}
|
||||
|
||||
// test_err empty_param_slot
|
||||
// fn f(y: i32, ,t: i32) {}
|
||||
pub(super) fn param_list_fn_def(p: &mut Parser<'_>) {
|
||||
list_(p, Flavor::FnDef);
|
||||
}
|
||||
|
@ -71,7 +74,11 @@ fn list_(p: &mut Parser<'_>, flavor: Flavor) {
|
|||
if !p.at_ts(PARAM_FIRST.union(ATTRIBUTE_FIRST)) {
|
||||
p.error("expected value parameter");
|
||||
m.abandon(p);
|
||||
break;
|
||||
if p.eat(T![,]) {
|
||||
continue;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
param(p, m, flavor);
|
||||
if !p.at(T![,]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue