mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-08-31 15:47:31 +00:00
Improve const generics parsing
- Handle const generics type args - Fix issue with const generic as first parameter in trait impl
This commit is contained in:
parent
c92a090f49
commit
ce1b34fd59
9 changed files with 123 additions and 21 deletions
|
@ -1 +1 @@
|
|||
type A = B<'static, i32, Item=u64>;
|
||||
type A = B<'static, i32, 1, { 2 }, Item=u64>;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_FILE@[0; 36)
|
||||
TYPE_ALIAS_DEF@[0; 35)
|
||||
SOURCE_FILE@[0; 46)
|
||||
TYPE_ALIAS_DEF@[0; 45)
|
||||
TYPE_KW@[0; 4) "type"
|
||||
WHITESPACE@[4; 5) " "
|
||||
NAME@[5; 6)
|
||||
|
@ -7,12 +7,12 @@ SOURCE_FILE@[0; 36)
|
|||
WHITESPACE@[6; 7) " "
|
||||
EQ@[7; 8) "="
|
||||
WHITESPACE@[8; 9) " "
|
||||
PATH_TYPE@[9; 34)
|
||||
PATH@[9; 34)
|
||||
PATH_SEGMENT@[9; 34)
|
||||
PATH_TYPE@[9; 44)
|
||||
PATH@[9; 44)
|
||||
PATH_SEGMENT@[9; 44)
|
||||
NAME_REF@[9; 10)
|
||||
IDENT@[9; 10) "B"
|
||||
TYPE_ARG_LIST@[10; 34)
|
||||
TYPE_ARG_LIST@[10; 44)
|
||||
L_ANGLE@[10; 11) "<"
|
||||
LIFETIME_ARG@[11; 18)
|
||||
LIFETIME@[11; 18) "\'static"
|
||||
|
@ -26,15 +26,30 @@ SOURCE_FILE@[0; 36)
|
|||
IDENT@[20; 23) "i32"
|
||||
COMMA@[23; 24) ","
|
||||
WHITESPACE@[24; 25) " "
|
||||
ASSOC_TYPE_ARG@[25; 33)
|
||||
NAME_REF@[25; 29)
|
||||
IDENT@[25; 29) "Item"
|
||||
EQ@[29; 30) "="
|
||||
PATH_TYPE@[30; 33)
|
||||
PATH@[30; 33)
|
||||
PATH_SEGMENT@[30; 33)
|
||||
NAME_REF@[30; 33)
|
||||
IDENT@[30; 33) "u64"
|
||||
R_ANGLE@[33; 34) ">"
|
||||
SEMI@[34; 35) ";"
|
||||
WHITESPACE@[35; 36) "\n"
|
||||
CONST_ARG@[25; 26)
|
||||
INT_NUMBER@[25; 26) "1"
|
||||
COMMA@[26; 27) ","
|
||||
WHITESPACE@[27; 28) " "
|
||||
CONST_ARG@[28; 33)
|
||||
BLOCK_EXPR@[28; 33)
|
||||
BLOCK@[28; 33)
|
||||
L_CURLY@[28; 29) "{"
|
||||
WHITESPACE@[29; 30) " "
|
||||
LITERAL@[30; 31)
|
||||
INT_NUMBER@[30; 31) "2"
|
||||
WHITESPACE@[31; 32) " "
|
||||
R_CURLY@[32; 33) "}"
|
||||
COMMA@[33; 34) ","
|
||||
WHITESPACE@[34; 35) " "
|
||||
ASSOC_TYPE_ARG@[35; 43)
|
||||
NAME_REF@[35; 39)
|
||||
IDENT@[35; 39) "Item"
|
||||
EQ@[39; 40) "="
|
||||
PATH_TYPE@[40; 43)
|
||||
PATH@[40; 43)
|
||||
PATH_SEGMENT@[40; 43)
|
||||
NAME_REF@[40; 43)
|
||||
IDENT@[40; 43) "u64"
|
||||
R_ANGLE@[43; 44) ">"
|
||||
SEMI@[44; 45) ";"
|
||||
WHITESPACE@[45; 46) "\n"
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
impl<const N: u32> Bar<N> {}
|
|
@ -0,0 +1,38 @@
|
|||
SOURCE_FILE@[0; 29)
|
||||
IMPL_BLOCK@[0; 28)
|
||||
IMPL_KW@[0; 4) "impl"
|
||||
TYPE_PARAM_LIST@[4; 18)
|
||||
L_ANGLE@[4; 5) "<"
|
||||
CONST_PARAM@[5; 17)
|
||||
CONST_KW@[5; 10) "const"
|
||||
WHITESPACE@[10; 11) " "
|
||||
NAME@[11; 12)
|
||||
IDENT@[11; 12) "N"
|
||||
COLON@[12; 13) ":"
|
||||
WHITESPACE@[13; 14) " "
|
||||
PATH_TYPE@[14; 17)
|
||||
PATH@[14; 17)
|
||||
PATH_SEGMENT@[14; 17)
|
||||
NAME_REF@[14; 17)
|
||||
IDENT@[14; 17) "u32"
|
||||
R_ANGLE@[17; 18) ">"
|
||||
WHITESPACE@[18; 19) " "
|
||||
PATH_TYPE@[19; 25)
|
||||
PATH@[19; 25)
|
||||
PATH_SEGMENT@[19; 25)
|
||||
NAME_REF@[19; 22)
|
||||
IDENT@[19; 22) "Bar"
|
||||
TYPE_ARG_LIST@[22; 25)
|
||||
L_ANGLE@[22; 23) "<"
|
||||
TYPE_ARG@[23; 24)
|
||||
PATH_TYPE@[23; 24)
|
||||
PATH@[23; 24)
|
||||
PATH_SEGMENT@[23; 24)
|
||||
NAME_REF@[23; 24)
|
||||
IDENT@[23; 24) "N"
|
||||
R_ANGLE@[24; 25) ">"
|
||||
WHITESPACE@[25; 26) " "
|
||||
ITEM_LIST@[26; 28)
|
||||
L_CURLY@[26; 27) "{"
|
||||
R_CURLY@[27; 28) "}"
|
||||
WHITESPACE@[28; 29) "\n"
|
Loading…
Add table
Add a link
Reference in a new issue