mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Merge #599
599: Allow placeholder parameters in trait function definitions r=matklad a=regiontog fixes #597 Co-authored-by: Erlend Tobiassen <erlend.tobiassen@gmail.com>
This commit is contained in:
commit
b9f65b18b8
3 changed files with 41 additions and 1 deletions
|
@ -79,7 +79,12 @@ fn value_parameter(p: &mut Parser, flavor: Flavor) {
|
|||
let la1 = p.nth(1);
|
||||
let la2 = p.nth(2);
|
||||
let la3 = p.nth(3);
|
||||
if la0 == IDENT && la1 == COLON
|
||||
|
||||
// test trait_fn_placeholder_parameter
|
||||
// trait Foo {
|
||||
// fn bar(_: u64);
|
||||
// }
|
||||
if (la0 == IDENT || la0 == UNDERSCORE) && la1 == COLON
|
||||
|| la0 == AMP && la1 == IDENT && la2 == COLON
|
||||
|| la0 == AMP && la1 == MUT_KW && la2 == IDENT && la3 == COLON
|
||||
{
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
trait Foo {
|
||||
fn bar(_: u64);
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
SOURCE_FILE@[0; 34)
|
||||
TRAIT_DEF@[0; 33)
|
||||
TRAIT_KW@[0; 5)
|
||||
WHITESPACE@[5; 6)
|
||||
NAME@[6; 9)
|
||||
IDENT@[6; 9) "Foo"
|
||||
WHITESPACE@[9; 10)
|
||||
ITEM_LIST@[10; 33)
|
||||
L_CURLY@[10; 11)
|
||||
WHITESPACE@[11; 16)
|
||||
FN_DEF@[16; 31)
|
||||
FN_KW@[16; 18)
|
||||
WHITESPACE@[18; 19)
|
||||
NAME@[19; 22)
|
||||
IDENT@[19; 22) "bar"
|
||||
PARAM_LIST@[22; 30)
|
||||
L_PAREN@[22; 23)
|
||||
PARAM@[23; 29)
|
||||
PLACEHOLDER_PAT@[23; 24)
|
||||
UNDERSCORE@[23; 24)
|
||||
COLON@[24; 25)
|
||||
WHITESPACE@[25; 26)
|
||||
PATH_TYPE@[26; 29)
|
||||
PATH@[26; 29)
|
||||
PATH_SEGMENT@[26; 29)
|
||||
NAME_REF@[26; 29)
|
||||
IDENT@[26; 29) "u64"
|
||||
R_PAREN@[29; 30)
|
||||
SEMI@[30; 31)
|
||||
WHITESPACE@[31; 32)
|
||||
R_CURLY@[32; 33)
|
||||
WHITESPACE@[33; 34)
|
Loading…
Reference in a new issue