mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
Allow true
and false
keywords in const generics
This commit is contained in:
parent
77362c7173
commit
dcb4c0ada6
3 changed files with 25 additions and 11 deletions
|
@ -26,7 +26,7 @@ pub(super) fn opt_generic_arg_list(p: &mut Parser, colon_colon_required: bool) {
|
|||
}
|
||||
|
||||
// test type_arg
|
||||
// type A = B<'static, i32, 1, { 2 }, Item=u64>;
|
||||
// type A = B<'static, i32, 1, { 2 }, Item=u64, true, false>;
|
||||
fn generic_arg(p: &mut Parser) {
|
||||
let m = p.start();
|
||||
match p.current() {
|
||||
|
@ -55,6 +55,10 @@ fn generic_arg(p: &mut Parser) {
|
|||
expressions::literal(p);
|
||||
m.complete(p, CONST_ARG);
|
||||
}
|
||||
TRUE_KW | FALSE_KW => {
|
||||
expressions::literal(p);
|
||||
m.complete(p, CONST_ARG);
|
||||
}
|
||||
_ => {
|
||||
types::type_(p);
|
||||
m.complete(p, TYPE_ARG);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
SOURCE_FILE@0..46
|
||||
TYPE_ALIAS@0..45
|
||||
SOURCE_FILE@0..59
|
||||
TYPE_ALIAS@0..58
|
||||
TYPE_KW@0..4 "type"
|
||||
WHITESPACE@4..5 " "
|
||||
NAME@5..6
|
||||
|
@ -7,12 +7,12 @@ SOURCE_FILE@0..46
|
|||
WHITESPACE@6..7 " "
|
||||
EQ@7..8 "="
|
||||
WHITESPACE@8..9 " "
|
||||
PATH_TYPE@9..44
|
||||
PATH@9..44
|
||||
PATH_SEGMENT@9..44
|
||||
PATH_TYPE@9..57
|
||||
PATH@9..57
|
||||
PATH_SEGMENT@9..57
|
||||
NAME_REF@9..10
|
||||
IDENT@9..10 "B"
|
||||
GENERIC_ARG_LIST@10..44
|
||||
GENERIC_ARG_LIST@10..57
|
||||
L_ANGLE@10..11 "<"
|
||||
LIFETIME_ARG@11..18
|
||||
LIFETIME@11..18
|
||||
|
@ -51,6 +51,16 @@ SOURCE_FILE@0..46
|
|||
PATH_SEGMENT@40..43
|
||||
NAME_REF@40..43
|
||||
IDENT@40..43 "u64"
|
||||
R_ANGLE@43..44 ">"
|
||||
SEMICOLON@44..45 ";"
|
||||
WHITESPACE@45..46 "\n"
|
||||
COMMA@43..44 ","
|
||||
WHITESPACE@44..45 " "
|
||||
CONST_ARG@45..49
|
||||
LITERAL@45..49
|
||||
TRUE_KW@45..49 "true"
|
||||
COMMA@49..50 ","
|
||||
WHITESPACE@50..51 " "
|
||||
CONST_ARG@51..56
|
||||
LITERAL@51..56
|
||||
FALSE_KW@51..56 "false"
|
||||
R_ANGLE@56..57 ">"
|
||||
SEMICOLON@57..58 ";"
|
||||
WHITESPACE@58..59 "\n"
|
||||
|
|
|
@ -1 +1 @@
|
|||
type A = B<'static, i32, 1, { 2 }, Item=u64>;
|
||||
type A = B<'static, i32, 1, { 2 }, Item=u64, true, false>;
|
||||
|
|
Loading…
Reference in a new issue