mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-26 13:03:31 +00:00
refactor: Rename and move const_arg_path
It wasn't testing the `const_arg` code path, it was actually hitting const_param's default value code path, so move it to the right place and rename it.
This commit is contained in:
parent
e84453c47f
commit
8a28430676
6 changed files with 41 additions and 33 deletions
|
@ -99,9 +99,8 @@ pub(super) fn const_arg_expr(p: &mut Parser) {
|
||||||
expressions::literal(p);
|
expressions::literal(p);
|
||||||
lm.complete(p, PREFIX_EXPR);
|
lm.complete(p, PREFIX_EXPR);
|
||||||
}
|
}
|
||||||
// test const_arg_path
|
|
||||||
// type T = S<u32::MAX>;
|
|
||||||
_ => {
|
_ => {
|
||||||
|
// This shouldn't be hit by `const_arg`
|
||||||
let lm = p.start();
|
let lm = p.start();
|
||||||
paths::use_path(p);
|
paths::use_path(p);
|
||||||
lm.complete(p, PATH_EXPR);
|
lm.complete(p, PATH_EXPR);
|
||||||
|
|
|
@ -85,6 +85,9 @@ fn const_param(p: &mut Parser, m: Marker) {
|
||||||
|
|
||||||
// test const_param_default_expression
|
// test const_param_default_expression
|
||||||
// struct A<const N: i32 = { 1 }>;
|
// struct A<const N: i32 = { 1 }>;
|
||||||
|
|
||||||
|
// test const_param_default_path
|
||||||
|
// struct A<const N: i32 = i32::MAX>;
|
||||||
generic_args::const_arg_expr(p);
|
generic_args::const_arg_expr(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
SOURCE_FILE
|
|
||||||
TYPE_ALIAS
|
|
||||||
TYPE_KW "type"
|
|
||||||
WHITESPACE " "
|
|
||||||
NAME
|
|
||||||
IDENT "T"
|
|
||||||
WHITESPACE " "
|
|
||||||
EQ "="
|
|
||||||
WHITESPACE " "
|
|
||||||
PATH_TYPE
|
|
||||||
PATH
|
|
||||||
PATH_SEGMENT
|
|
||||||
NAME_REF
|
|
||||||
IDENT "S"
|
|
||||||
GENERIC_ARG_LIST
|
|
||||||
L_ANGLE "<"
|
|
||||||
TYPE_ARG
|
|
||||||
PATH_TYPE
|
|
||||||
PATH
|
|
||||||
PATH
|
|
||||||
PATH_SEGMENT
|
|
||||||
NAME_REF
|
|
||||||
IDENT "u32"
|
|
||||||
COLON2 "::"
|
|
||||||
PATH_SEGMENT
|
|
||||||
NAME_REF
|
|
||||||
IDENT "MAX"
|
|
||||||
R_ANGLE ">"
|
|
||||||
SEMICOLON ";"
|
|
||||||
WHITESPACE "\n"
|
|
|
@ -1 +0,0 @@
|
||||||
type T = S<u32::MAX>;
|
|
|
@ -0,0 +1,36 @@
|
||||||
|
SOURCE_FILE
|
||||||
|
STRUCT
|
||||||
|
STRUCT_KW "struct"
|
||||||
|
WHITESPACE " "
|
||||||
|
NAME
|
||||||
|
IDENT "A"
|
||||||
|
GENERIC_PARAM_LIST
|
||||||
|
L_ANGLE "<"
|
||||||
|
CONST_PARAM
|
||||||
|
CONST_KW "const"
|
||||||
|
WHITESPACE " "
|
||||||
|
NAME
|
||||||
|
IDENT "N"
|
||||||
|
COLON ":"
|
||||||
|
WHITESPACE " "
|
||||||
|
PATH_TYPE
|
||||||
|
PATH
|
||||||
|
PATH_SEGMENT
|
||||||
|
NAME_REF
|
||||||
|
IDENT "i32"
|
||||||
|
WHITESPACE " "
|
||||||
|
EQ "="
|
||||||
|
WHITESPACE " "
|
||||||
|
PATH_EXPR
|
||||||
|
PATH
|
||||||
|
PATH
|
||||||
|
PATH_SEGMENT
|
||||||
|
NAME_REF
|
||||||
|
IDENT "i32"
|
||||||
|
COLON2 "::"
|
||||||
|
PATH_SEGMENT
|
||||||
|
NAME_REF
|
||||||
|
IDENT "MAX"
|
||||||
|
R_ANGLE ">"
|
||||||
|
SEMICOLON ";"
|
||||||
|
WHITESPACE "\n"
|
|
@ -0,0 +1 @@
|
||||||
|
struct A<const N: i32 = i32::MAX>;
|
Loading…
Reference in a new issue